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) |
A set of functions for fast binary operations.
unsigned int binOp::binLength | ( | unsigned int | num | ) |
Definition at line 24 of file binUtils.cpp.
unsigned int binOp::binToDec | ( | unsigned int * | numBin, |
unsigned int | binLen | ||
) |
numBin | binary representation of the number |
binLen | length of numBin |
Definition at line 47 of file binUtils.cpp.
unsigned int binOp::fastLog2 | ( | unsigned int | num | ) |
return log to base 2 of num
Definition at line 15 of file binUtils.cpp.
int binOp::getNextHighestPowerOfTwo | ( | unsigned int | n | ) |
Definition at line 61 of file binUtils.cpp.
int binOp::getPrevHighestPowerOfTwo | ( | unsigned int | n | ) |
Definition at line 75 of file binUtils.cpp.
bool binOp::isPowerOfTwo | ( | unsigned int | n | ) |
Definition at line 56 of file binUtils.cpp.
unsigned int binOp::reversibleHash | ( | unsigned int | x | ) |
psuedo random generator ... kind of ...
Definition at line 88 of file binUtils.cpp.
int binOp::toBin | ( | unsigned int | dec, |
unsigned int | binLen, | ||
std::vector< bool > & | result | ||
) |
Converts a decimal number to binary.
dec | the decimal number |
binLen | the number of digits required in the binary representation |
result | the binary representation |
Definition at line 33 of file binUtils.cpp.