|
uint64_t | mask (int nbits) |
| Generate a 64-bit mask of 'nbits' 1s, right justified. More...
|
|
template<class T > |
T | bits (T val, int first, int last) |
| Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it. More...
|
|
template<class T > |
T | bits (T val, int bit) |
| Extract the bit from this position from 'val' and right justify it. More...
|
|
template<class T > |
T | mbits (T val, int first, int last) |
| Mask off the given bits in place like bits() but without shifting. More...
|
|
uint64_t | mask (int first, int last) |
|
template<int N> |
uint64_t | sext (uint64_t val) |
| Sign-extend an N-bit value to 64 bits. More...
|
|
template<class T , class B > |
T | insertBits (T val, int first, int last, B bit_val) |
| Returns val with bits first to last set to the LSBs of bit_val. More...
|
|
template<class T , class B > |
T | insertBits (T val, int bit, B bit_val) |
| Overloaded for access to only one bit in value. More...
|
|
template<class T , class B > |
void | replaceBits (T &val, int first, int last, B bit_val) |
| A convenience function to replace bits first to last of val with bit_val in place. More...
|
|
template<class T , class B > |
void | replaceBits (T &val, int bit, B bit_val) |
| Overloaded function to allow to access only 1 bit. More...
|
|
template<class T > |
T | reverseBits (T val, std::size_t size=sizeof(T)) |
| Takes a variable lenght word and returns the mirrored version (Bit by bit, LSB=>MSB). More...
|
|
int | findMsbSet (uint64_t val) |
| Returns the bit position of the MSB that is set in the input. More...
|
|
int | findLsbSet (uint64_t val) |
| Returns the bit position of the LSB that is set in the input. More...
|
|
template<class T > |
bool | isPow2 (T v) |
| Checks if a number is a power of two, or zero. More...
|
|
int | popCount (uint64_t val) |
| Returns the number of set ones in the provided value. More...
|
|
uint64_t | alignToPowerOfTwo (uint64_t val) |
| Align to the next highest power of two. More...
|
|
int | ctz32 (uint32_t value) |
| Count trailing zeros in a 32-bit value. More...
|
|
int | ctz64 (uint64_t value) |
| Count trailing zeros in a 64-bit value. More...
|
|