23 #ifndef __ccxx_Numeric_hxx 24 #define __ccxx_Numeric_hxx 158 template<
typename S,
typename T>
161 if((value < std::numeric_limits<T>::min())
162 || (value > std::numeric_limits<T>::max()))
165 return(static_cast<T>(value));
175 template<
typename S,
typename T>
178 if(value < std::numeric_limits<T>::min())
179 return(std::numeric_limits<T>::min());
180 else if(value > std::numeric_limits<T>::max())
181 return(std::numeric_limits<T>::max());
183 return(static_cast<T>(value));
207 #endif // __ccxx_Numeric_hxx static uint32_t leastSignificantSetBit(uint32_t value)
Find the least significant bit that is set in a value.
Definition: Numeric.c++:52
static uint_t countSetBits(uint32_t value)
Count the number of bits that are set in a value.
Definition: Numeric.c++:99
unsigned int uint_t
An alias for unsigned int.
Definition: Integers.h++:74
static uint_t countLeadingZeroes(uint32_t value)
Count the number of leading zeroes in a value.
Definition: Numeric.c++:129
T numeric_clipping_cast(S value)
A range-clipping numeric cast.
Definition: Numeric.h++:176
An exception indicating that an attempted operation would result in an out-of-range array index acces...
Definition: OutOfBoundsException.h++:38
T numeric_clip(T value, T min, T max)
A numeric range-clipping function.
Definition: Numeric.h++:196
static uint32_t nextPowerOf2(uint32_t value)
Calculate the next higher power of 2 for a value.
Definition: Numeric.c++:35
static uint_t countTrailingZeroes(uint32_t value)
Count the number of trailing zeroes in a value.
Definition: Numeric.c++:158
static uint32_t mostSignificantSetBit(uint32_t value)
Find the most significant bit that is set in a value.
Definition: Numeric.c++:70
T numeric_cast(S value)
A range-checked numeric cast.
Definition: Numeric.h++:159
Definition: AllocationMap.c++:25
Numeric and bitwise utility functions.
Definition: Numeric.h++:46