COMBINATORIAL_BLAS  1.6
binOp Namespace Reference

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

Functions

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

Detailed Description

A set of functions for fast binary operations.

Author
Hari Sundar

Function Documentation

◆ binLength()

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.cpp.

◆ binToDec()

unsigned int binOp::binToDec ( unsigned int *  numBin,
unsigned int  binLen 
)
Parameters
numBinbinary representation of the number
binLenlength of numBin
Returns
the decimal representation of the binary number

Definition at line 47 of file binUtils.cpp.

◆ fastLog2()

unsigned int binOp::fastLog2 ( unsigned int  num)

return log to base 2 of num

Definition at line 15 of file binUtils.cpp.

◆ getNextHighestPowerOfTwo()

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.cpp.

◆ getPrevHighestPowerOfTwo()

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.cpp.

◆ isPowerOfTwo()

bool binOp::isPowerOfTwo ( unsigned int  n)
Returns
true if n is a power of 2.

Definition at line 56 of file binUtils.cpp.

◆ reversibleHash()

unsigned int binOp::reversibleHash ( unsigned int  x)

psuedo random generator ... kind of ...

Definition at line 88 of file binUtils.cpp.

◆ toBin()

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

Converts a decimal number to binary.

Parameters
decthe decimal number
binLenthe number of digits required in the binary representation
resultthe binary representation
Returns
error flag

Definition at line 33 of file binUtils.cpp.