Numeric and bitwise utility functions.
More...
#include <Numeric.h++>
Numeric and bitwise utility functions.
Algorithms taken from http://aggregate.org/MAGIC
- Author
- Mark Lindner
◆ countLeadingZeroes() [1/2]
uint_t countLeadingZeroes |
( |
uint32_t |
value | ) |
|
|
static |
Count the number of leading zeroes in a value.
- Parameters
-
- Returns
- The number of leading zeroes in the value.
◆ countLeadingZeroes() [2/2]
uint_t countLeadingZeroes |
( |
uint64_t |
value | ) |
|
|
static |
Count the number of leading zeroes in a value.
- Parameters
-
- Returns
- The number of leading zeroes in the value.
◆ countSetBits() [1/2]
uint_t countSetBits |
( |
uint32_t |
value | ) |
|
|
static |
Count the number of bits that are set in a value.
- Parameters
-
- Returns
- The count of bits that are set in the value.
◆ countSetBits() [2/2]
uint_t countSetBits |
( |
uint64_t |
value | ) |
|
|
static |
Count the number of bits that are set in a value.
- Parameters
-
- Returns
- The count of bits that are set in the value.
◆ countTrailingZeroes() [1/2]
uint_t countTrailingZeroes |
( |
uint32_t |
value | ) |
|
|
static |
Count the number of trailing zeroes in a value.
- Parameters
-
- Returns
- The number of trailing zeroes in the value.
◆ countTrailingZeroes() [2/2]
uint_t countTrailingZeroes |
( |
uint64_t |
value | ) |
|
|
static |
Count the number of trailing zeroes in a value.
- Parameters
-
- Returns
- The number of trailing zeroes in the value.
◆ leastSignificantSetBit() [1/2]
uint32_t leastSignificantSetBit |
( |
uint32_t |
value | ) |
|
|
static |
Find the least significant bit that is set in a value.
- Parameters
-
- Returns
- A value with the same least significant bit set as the input, but with all other bits clear.
◆ leastSignificantSetBit() [2/2]
uint64_t leastSignificantSetBit |
( |
uint64_t |
value | ) |
|
|
static |
Find the least significant bit that is set in a value.
- Parameters
-
- Returns
- A value with the same least significant bit set as the input, but with all other bits clear.
◆ mostSignificantSetBit() [1/2]
uint32_t mostSignificantSetBit |
( |
uint32_t |
value | ) |
|
|
static |
Find the most significant bit that is set in a value.
- Parameters
-
- Returns
- A value with the same most significant bit set as the input, but with all other bits clear.
◆ mostSignificantSetBit() [2/2]
uint64_t mostSignificantSetBit |
( |
uint64_t |
value | ) |
|
|
static |
Find the most significant bit that is set in a value.
- Parameters
-
- Returns
- A value with the same most significant bit set as the input, but with all other bits clear.
◆ nextPowerOf2()
uint32_t nextPowerOf2 |
( |
uint32_t |
value | ) |
|
|
static |
Calculate the next higher power of 2 for a value.
- Parameters
-
- Returns
- The smallest power of 2 that is greater than or equal to the value, or 0 if the value is 0 or greater than 2^31.
The documentation for this class was generated from the following files: