Go to the source code of this file.
Functions | |
static int64_t | abs64 (int64_t x) |
static double | BitsToDouble (uint64_t Bits) |
static float | BitsToFloat (uint32_t Bits) |
static unsigned | CountLeadingOnes_32 (uint32_t Value) |
static unsigned | CountLeadingOnes_64 (uint64_t Value) |
static unsigned int | countLeadingZeros (int x) |
Count number of 0's from the most significant bit to the least stopping at the first 1. More... | |
static unsigned | CountLeadingZeros_32 (uint32_t Value) |
static unsigned | CountLeadingZeros_64 (uint64_t Value) |
static unsigned | CountPopulation_32 (uint32_t Value) |
static unsigned | CountPopulation_64 (uint64_t Value) |
static unsigned | CountTrailingOnes_32 (uint32_t Value) |
static unsigned | CountTrailingOnes_64 (uint64_t Value) |
static unsigned | CountTrailingZeros_32 (uint32_t Value) |
static unsigned | CountTrailingZeros_64 (uint64_t Value) |
static uint64_t | DoubleToBits (double Double) |
static uint32_t | FloatToBits (float Float) |
static uint64_t | GreatestCommonDivisor64 (uint64_t A, uint64_t B) |
static uint32_t | Hi_32 (uint64_t Value) |
Hi_32 - This function returns the high 32 bits of a 64 bit value. More... | |
static bool | isMask_32 (uint32_t Value) |
static bool | isMask_64 (uint64_t Value) |
static bool | isPowerOf2_32 (uint32_t Value) |
static bool | isShiftedMask_32 (uint32_t Value) |
static bool | isShiftedMask_64 (uint64_t Value) |
static bool | isUIntN (unsigned N, uint64_t x) |
static uint32_t | Lo_32 (uint64_t Value) |
Lo_32 - This function returns the low 32 bits of a 64 bit value. More... | |
static unsigned | Log2_32 (uint32_t Value) |
static unsigned | Log2_32_Ceil (uint32_t Value) |
static unsigned | Log2_64 (uint64_t Value) |
static unsigned | Log2_64_Ceil (uint64_t Value) |
static uint64_t | MinAlign (uint64_t A, uint64_t B) |
static uint64_t | NextPowerOf2 (uint64_t A) |
static uint64_t | OffsetToAlignment (uint64_t Value, uint64_t Align) |
static uint64_t | RoundUpToAlignment (uint64_t Value, uint64_t Align) |
static int32_t | SignExtend32 (uint32_t X, unsigned B) |
Sign extend number in the bottom B bits of X to a 32-bit int. Requires 0 < B <= 32. More... | |
static int64_t | SignExtend64 (uint64_t X, unsigned B) |
Sign extend number in the bottom B bits of X to a 64-bit int. Requires 0 < B <= 64. More... | |
abs64 - absolute value of a 64-bit int. Not all environments support "abs" on whatever their name for the 64-bit int type is. The absolute value of the largest negative number is undefined, as with "abs".
Definition at line 401 of file MathExtras.h.
|
inlinestatic |
BitsToDouble - This function takes a 64-bit integer and returns the bit equivalent double.
Definition at line 309 of file MathExtras.h.
|
inlinestatic |
BitsToFloat - This function takes a 32-bit integer and returns the bit equivalent float.
Definition at line 320 of file MathExtras.h.
|
inlinestatic |
CountLeadingOnes_32 - this function performs the operation of counting the number of ones from the most significant bit to the first zero bit. Ex. CountLeadingOnes_32(0xFF0FFF00) == 8. Returns 32 if the word is all ones.
Definition at line 124 of file MathExtras.h.
|
inlinestatic |
CountLeadingOnes_64 - This function performs the operation of counting the number of ones from the most significant bit to the first zero bit (64 bit edition.) Returns 64 if the word is all ones.
Definition at line 182 of file MathExtras.h.
Count number of 0's from the most significant bit to the least stopping at the first 1.
Only unsigned integral types are allowed.
ZB | the behavior on an input of 0. Only ZB_Width and ZB_Undefined are valid arguments. |
Definition at line 424 of file MathExtras.h.
|
inlinestatic |
CountLeadingZeros_32 - this function performs the platform optimal form of counting the number of zeros from the most significant bit to the first one bit. Ex. CountLeadingZeros_32(0x00F000FF) == 8. Returns 32 if the word is zero.
Definition at line 95 of file MathExtras.h.
|
inlinestatic |
CountLeadingZeros_64 - This function performs the platform optimal form of counting the number of zeros from the most significant bit to the first one bit (64 bit edition.) Returns 64 if the word is zero.
Definition at line 132 of file MathExtras.h.
|
inlinestatic |
CountPopulation_32 - this function counts the number of set bits in a value. Ex. CountPopulation(0xF000F000) = 8 Returns 0 if the word is zero.
Definition at line 247 of file MathExtras.h.
|
inlinestatic |
CountPopulation_64 - this function counts the number of set bits in a value, (64 bit edition.)
Definition at line 259 of file MathExtras.h.
|
inlinestatic |
CountTrailingOnes_32 - this function performs the operation of counting the number of ones from the least significant bit to the first zero bit. Ex. CountTrailingOnes_32(0x00FF00FF) == 8. Returns 32 if the word is all ones.
Definition at line 210 of file MathExtras.h.
|
inlinestatic |
CountTrailingOnes_64 - This function performs the operation of counting the number of ones from the least significant bit to the first zero bit (64 bit edition.) Returns 64 if the word is all ones.
Definition at line 240 of file MathExtras.h.
|
inlinestatic |
CountTrailingZeros_32 - this function performs the platform optimal form of counting the number of zeros from the least significant bit to the first one bit. Ex. CountTrailingZeros_32(0xFF00FF00) == 8. Returns 32 if the word is zero.
Definition at line 190 of file MathExtras.h.
|
inlinestatic |
CountTrailingZeros_64 - This function performs the platform optimal form of counting the number of zeros from the least significant bit to the first one bit (64 bit edition.) Returns 64 if the word is zero.
Definition at line 218 of file MathExtras.h.
|
inlinestatic |
DoubleToBits - This function takes a double and returns the bit equivalent 64-bit integer. Note that copying doubles around changes the bits of NaNs on some hosts, notably x86, so this routine cannot be used if these bits are needed.
Definition at line 333 of file MathExtras.h.
|
inlinestatic |
FloatToBits - This function takes a float and returns the bit equivalent 32-bit integer. Note that copying floats around changes the bits of NaNs on some hosts, notably x86, so this routine cannot be used if these bits are needed.
Definition at line 346 of file MathExtras.h.
GreatestCommonDivisor64 - Return the greatest common divisor of the two values using Euclid's algorithm.
Definition at line 298 of file MathExtras.h.
Hi_32 - This function returns the high 32 bits of a 64 bit value.
Definition at line 37 of file MathExtras.h.
isIntN - Checks if an signed integer fits into the given (dynamic) bit width. isMask_32 - This function returns true if the argument is a sequence of ones starting at the least significant bit with the remainder zero (32 bit version). Ex. isMask_32(0x0000FFFFU) == true.
Definition at line 61 of file MathExtras.h.
isMask_64 - This function returns true if the argument is a sequence of ones starting at the least significant bit with the remainder zero (64 bit version).
Definition at line 68 of file MathExtras.h.
isPowerOf2_32 - This function returns true if the argument is a power of two > 0. Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.)
Definition at line 87 of file MathExtras.h.
isShiftedMask_32 - This function returns true if the argument contains a sequence of ones with the remainder zero (32 bit version.) Ex. isShiftedMask_32(0x0000FF00U) == true.
Definition at line 75 of file MathExtras.h.
isShiftedMask_64 - This function returns true if the argument contains a sequence of ones with the remainder zero (64 bit version.)
Definition at line 81 of file MathExtras.h.
isUIntN - Checks if an unsigned integer fits into the given (dynamic) bit width.
Definition at line 48 of file MathExtras.h.
Lo_32 - This function returns the low 32 bits of a 64 bit value.
Definition at line 42 of file MathExtras.h.
|
inlinestatic |
Log2_32 - This function returns the floor log base 2 of the specified value, -1 if the value is zero. (32 bit edition.) Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2
Definition at line 273 of file MathExtras.h.
|
inlinestatic |
Log2_32_Ceil - This function returns the ceil log base 2 of the specified value, 32 if the value is zero. (32 bit edition). Ex. Log2_32_Ceil(32) == 5, Log2_32_Ceil(1) == 0, Log2_32_Ceil(6) == 3
Definition at line 286 of file MathExtras.h.
|
inlinestatic |
Log2_64 - This function returns the floor log base 2 of the specified value, -1 if the value is zero. (64 bit edition.)
Definition at line 279 of file MathExtras.h.
|
inlinestatic |
Log2_64_Ceil - This function returns the ceil log base 2 of the specified value, 64 if the value is zero. (64 bit edition.)
Definition at line 292 of file MathExtras.h.
MinAlign - A and B are either alignments or offsets. Return the minimum alignment that may be assumed after adding the two together.
Definition at line 357 of file MathExtras.h.
NextPowerOf2 - Returns the next power of two (in 64-bits) that is strictly greater than A. Returns zero on overflow.
Definition at line 368 of file MathExtras.h.
Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value
and is a multiple of Align
. Align
must be non-zero.
Definition at line 394 of file MathExtras.h.
Returns the next integer (mod 2**64) that is greater than or equal to Value
and is a multiple of Align
. Align
must be non-zero.
Examples:
Definition at line 387 of file MathExtras.h.
Sign extend number in the bottom B bits of X to a 32-bit int. Requires 0 < B <= 32.
Definition at line 407 of file MathExtras.h.
Sign extend number in the bottom B bits of X to a 64-bit int. Requires 0 < B <= 64.
Definition at line 413 of file MathExtras.h.