Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

binOp Namespace Reference

A set of functions for fast binary operations. More...


Functions

unsigned int binLength (unsigned int num)
unsigned int binToDec (unsigned int *numBin, unsigned int binLen)
unsigned int fastLog2 (unsigned int num)
int getNextHighestPowerOfTwo (unsigned int n)
int getPrevHighestPowerOfTwo (unsigned int n)
bool isPowerOfTwo (unsigned int n)
int toBin (unsigned int num, unsigned int binLen, std::vector< bool > &numBin)
 Converts a decimal number to binary.


Detailed Description

A set of functions for fast binary operations.

Author:
Hari Sundar


Function Documentation

unsigned int binOp::binLength unsigned int  num  ) 
 

Returns:
the minimum number of digits required to represent num in binary

Definition at line 24 of file binUtils.C.

Referenced by fastLog2(), ot::TreeNode::getMorton(), and ot::getNCA().

unsigned int binOp::binToDec unsigned int *  numBin,
unsigned int  binLen
 

Parameters:
numBin binary representation of the number
binLen length of numBin
Returns:
the decimal representation of the binary number

Definition at line 47 of file binUtils.C.

unsigned int binOp::fastLog2 unsigned int  num  ) 
 

return log to base 2 of num

Definition at line 15 of file binUtils.C.

References binLength().

Referenced by ot::regularGrid2Octree().

int binOp::getNextHighestPowerOfTwo unsigned int  n  ) 
 

Returns:
compute the next highest power of 2 of 32-bit v

Definition at line 61 of file binUtils.C.

int binOp::getPrevHighestPowerOfTwo unsigned int  n  ) 
 

Returns:
compute the prev highest power of 2 of 32-bit v

Definition at line 75 of file binUtils.C.

Referenced by par::Par_bitonic_merge_incr(), par::splitCommBinary(), and par::splitCommBinaryNoFlip().

bool binOp::isPowerOfTwo unsigned int  n  ) 
 

Returns:
true if n is a power of 2.

Definition at line 56 of file binUtils.C.

Referenced by ot::regularGrid2Octree().

int binOp::toBin unsigned int  dec,
unsigned int  binLen,
std::vector< bool > &  result
 

Converts a decimal number to binary.

Parameters:
dec the decimal number
binLen the number of digits required in the binary representation
result the binary representation
Returns:
error flag

Definition at line 33 of file binUtils.C.

Referenced by ot::TreeNode::getMorton().


Generated on Tue Mar 24 16:14:21 2009 for DENDRO by  doxygen 1.3.9.1