|
template<typename T > |
T | llvm::maskTrailingOnes (unsigned N) |
| Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.
|
|
template<typename T > |
T | llvm::maskLeadingOnes (unsigned N) |
| Create a bitmask with the N left-most bits set to 1, and all other bits set to 0.
|
|
template<typename T > |
T | llvm::maskTrailingZeros (unsigned N) |
| Create a bitmask with the N right-most bits set to 0, and all other bits set to 1.
|
|
template<typename T > |
T | llvm::maskLeadingZeros (unsigned N) |
| Create a bitmask with the N left-most bits set to 0, and all other bits set to 1.
|
|
template<typename T > |
T | llvm::reverseBits (T Val) |
| Reverse the bits in Val .
|
|
constexpr uint32_t | llvm::Hi_32 (uint64_t Value) |
| Return the high 32 bits of a 64 bit value.
|
|
constexpr uint32_t | llvm::Lo_32 (uint64_t Value) |
| Return the low 32 bits of a 64 bit value.
|
|
constexpr uint64_t | llvm::Make_64 (uint32_t High, uint32_t Low) |
| Make a 64-bit integer from a high / low pair of 32-bit integers.
|
|
template<unsigned N> |
constexpr bool | llvm::isInt (int64_t x) |
| Checks if an integer fits into the given bit width.
|
|
template<unsigned N, unsigned S> |
constexpr bool | llvm::isShiftedInt (int64_t x) |
| Checks if a signed integer is an N bit number shifted left by S.
|
|
template<unsigned N> |
constexpr bool | llvm::isUInt (uint64_t x) |
| Checks if an unsigned integer fits into the given bit width.
|
|
template<unsigned N, unsigned S> |
constexpr bool | llvm::isShiftedUInt (uint64_t x) |
| Checks if a unsigned integer is an N bit number shifted left by S.
|
|
uint64_t | llvm::maxUIntN (uint64_t N) |
| Gets the maximum value for a N-bit unsigned integer.
|
|
int64_t | llvm::minIntN (int64_t N) |
| Gets the minimum value for a N-bit signed integer.
|
|
int64_t | llvm::maxIntN (int64_t N) |
| Gets the maximum value for a N-bit signed integer.
|
|
bool | llvm::isUIntN (unsigned N, uint64_t x) |
| Checks if an unsigned integer fits into the given (dynamic) bit width.
|
|
bool | llvm::isIntN (unsigned N, int64_t x) |
| Checks if an signed integer fits into the given (dynamic) bit width.
|
|
constexpr bool | llvm::isMask_32 (uint32_t Value) |
| Return true if the argument is a non-empty sequence of ones starting at the least significant bit with the remainder zero (32 bit version).
|
|
constexpr bool | llvm::isMask_64 (uint64_t Value) |
| Return true if the argument is a non-empty sequence of ones starting at the least significant bit with the remainder zero (64 bit version).
|
|
constexpr bool | llvm::isShiftedMask_32 (uint32_t Value) |
| Return true if the argument contains a non-empty sequence of ones with the remainder zero (32 bit version.) Ex.
|
|
constexpr bool | llvm::isShiftedMask_64 (uint64_t Value) |
| Return true if the argument contains a non-empty sequence of ones with the remainder zero (64 bit version.)
|
|
constexpr bool | llvm::isPowerOf2_32 (uint32_t Value) |
| Return true if the argument is a power of two > 0.
|
|
constexpr bool | llvm::isPowerOf2_64 (uint64_t Value) |
| Return true if the argument is a power of two > 0 (64 bit edition.)
|
|
bool | llvm::isShiftedMask_32 (uint32_t Value, unsigned &MaskIdx, unsigned &MaskLen) |
| Return true if the argument contains a non-empty sequence of ones with the remainder zero (32 bit version.) Ex.
|
|
bool | llvm::isShiftedMask_64 (uint64_t Value, unsigned &MaskIdx, unsigned &MaskLen) |
| Return true if the argument contains a non-empty sequence of ones with the remainder zero (64 bit version.) If true, MaskIdx will specify the index of the lowest set bit and MaskLen is updated to specify the length of the mask, else neither are updated.
|
|
template<size_t kValue> |
constexpr size_t | llvm::CTLog2 () |
| Compile time Log2.
|
|
template<> |
constexpr size_t | llvm::CTLog2< 1 > () |
|
unsigned | llvm::Log2_32 (uint32_t Value) |
| Return the floor log base 2 of the specified value, -1 if the value is zero.
|
|
unsigned | llvm::Log2_64 (uint64_t Value) |
| Return the floor log base 2 of the specified value, -1 if the value is zero.
|
|
unsigned | llvm::Log2_32_Ceil (uint32_t Value) |
| Return the ceil log base 2 of the specified value, 32 if the value is zero.
|
|
unsigned | llvm::Log2_64_Ceil (uint64_t Value) |
| Return the ceil log base 2 of the specified value, 64 if the value is zero.
|
|
template<typename U , typename V , typename T = common_uint<U, V>> |
constexpr T | llvm::MinAlign (U A, V B) |
| A and B are either alignments or offsets.
|
|
constexpr uint64_t | llvm::MinAlign (uint64_t A, uint64_t B) |
| Fallback when arguments aren't integral.
|
|
constexpr uint64_t | llvm::NextPowerOf2 (uint64_t A) |
| Returns the next power of two (in 64-bits) that is strictly greater than A.
|
|
uint64_t | llvm::PowerOf2Ceil (uint64_t A) |
| Returns the power of two which is greater than or equal to the given value.
|
|
template<typename U , typename V , typename T = common_uint<U, V>> |
constexpr T | llvm::divideCeil (U Numerator, V Denominator) |
| Returns the integer ceil(Numerator / Denominator).
|
|
constexpr uint64_t | llvm::divideCeil (uint64_t Numerator, uint64_t Denominator) |
| Fallback when arguments aren't integral.
|
|
template<typename U , typename V > |
constexpr bool | llvm::divideSignedWouldOverflow (U Numerator, V Denominator) |
|
template<typename U , typename V , typename T = common_sint<U, V>> |
constexpr T | llvm::divideCeilSigned (U Numerator, V Denominator) |
| Returns the integer ceil(Numerator / Denominator).
|
|
template<typename U , typename V , typename T = common_sint<U, V>> |
constexpr T | llvm::divideFloorSigned (U Numerator, V Denominator) |
| Returns the integer floor(Numerator / Denominator).
|
|
template<typename U , typename V , typename T = common_sint<U, V>> |
constexpr T | llvm::mod (U Numerator, V Denominator) |
| Returns the remainder of the Euclidean division of LHS by RHS.
|
|
template<typename U , typename V , typename T = common_uint<U, V>> |
constexpr T | llvm::divideNearest (U Numerator, V Denominator) |
| Returns (Numerator / Denominator) rounded by round-half-up.
|
|
template<typename U , typename V , typename T = common_uint<U, V>> |
constexpr T | llvm::alignTo (U Value, V Align) |
| Returns the next integer (mod 2**nbits) that is greater than or equal to Value and is a multiple of Align .
|
|
constexpr uint64_t | llvm::alignTo (uint64_t Value, uint64_t Align) |
| Fallback when arguments aren't integral.
|
|
template<typename U , typename V , typename T = common_uint<U, V>> |
constexpr T | llvm::alignToPowerOf2 (U Value, V Align) |
| Will overflow only if result is not representable in T.
|
|
constexpr uint64_t | llvm::alignToPowerOf2 (uint64_t Value, uint64_t Align) |
| Fallback when arguments aren't integral.
|
|
template<typename U , typename V , typename W , typename T = common_uint<common_uint<U, V>, W>> |
constexpr T | llvm::alignTo (U Value, V Align, W Skew) |
| If non-zero Skew is specified, the return value will be a minimal integer that is greater than or equal to Size and equal to A * N + Skew for some integer N.
|
|
template<auto Align, typename V , typename T = common_uint<decltype(Align), V>> |
constexpr T | llvm::alignTo (V Value) |
| Returns the next integer (mod 2**nbits) that is greater than or equal to Value and is a multiple of Align .
|
|
template<typename U , typename V , typename W = uint8_t, typename T = common_uint<common_uint<U, V>, W>> |
constexpr T | llvm::alignDown (U Value, V Align, W Skew=0) |
| Returns the largest unsigned integer less than or equal to Value and is Skew mod Align .
|
|
template<unsigned B> |
constexpr int32_t | llvm::SignExtend32 (uint32_t X) |
| Sign-extend the number in the bottom B bits of X to a 32-bit integer.
|
|
int32_t | llvm::SignExtend32 (uint32_t X, unsigned B) |
| Sign-extend the number in the bottom B bits of X to a 32-bit integer.
|
|
template<unsigned B> |
constexpr int64_t | llvm::SignExtend64 (uint64_t x) |
| Sign-extend the number in the bottom B bits of X to a 64-bit integer.
|
|
int64_t | llvm::SignExtend64 (uint64_t X, unsigned B) |
| Sign-extend the number in the bottom B bits of X to a 64-bit integer.
|
|
template<typename U , typename V , typename T = common_uint<U, V>> |
constexpr T | llvm::AbsoluteDifference (U X, V Y) |
| Subtract two unsigned integers, X and Y, of type T and return the absolute value of the result.
|
|
template<typename T > |
std::enable_if_t< std::is_unsigned_v< T >, T > | llvm::SaturatingAdd (T X, T Y, bool *ResultOverflowed=nullptr) |
| Add two unsigned integers, X and Y, of type T.
|
|
template<class T , class... Ts> |
std::enable_if_t< std::is_unsigned_v< T >, T > | llvm::SaturatingAdd (T X, T Y, T Z, Ts... Args) |
| Add multiple unsigned integers of type T.
|
|
template<typename T > |
std::enable_if_t< std::is_unsigned_v< T >, T > | llvm::SaturatingMultiply (T X, T Y, bool *ResultOverflowed=nullptr) |
| Multiply two unsigned integers, X and Y, of type T.
|
|
template<typename T > |
std::enable_if_t< std::is_unsigned_v< T >, T > | llvm::SaturatingMultiplyAdd (T X, T Y, T A, bool *ResultOverflowed=nullptr) |
| Multiply two unsigned integers, X and Y, and add the unsigned integer, A to the product.
|
|
template<typename T > |
std::enable_if_t< std::is_signed_v< T >, T > | llvm::AddOverflow (T X, T Y, T &Result) |
| Add two signed integers, computing the two's complement truncated result, returning true if overflow occurred.
|
|
template<typename T > |
std::enable_if_t< std::is_signed_v< T >, T > | llvm::SubOverflow (T X, T Y, T &Result) |
| Subtract two signed integers, computing the two's complement truncated result, returning true if an overflow ocurred.
|
|
template<typename T > |
std::enable_if_t< std::is_signed_v< T >, T > | llvm::MulOverflow (T X, T Y, T &Result) |
| Multiply two signed integers, computing the two's complement truncated result, returning true if an overflow ocurred.
|
|