|
template<typename T > |
T | abs_diff (const T &a, const T &b) |
| absolute difference, which also works for unsigned types More...
|
|
static uint16_t | bswap16_generic (const uint16_t &x) |
| bswap16 - generic implementation More...
|
|
static uint16_t | bswap16 (const uint16_t &v) |
| bswap16 - generic More...
|
|
static uint32_t | bswap32_generic (const uint32_t &x) |
| bswap32 - generic implementation More...
|
|
static uint32_t | bswap32 (const uint32_t &v) |
| bswap32 - generic More...
|
|
static uint64_t | bswap64_generic (const uint64_t &x) |
| bswap64 - generic implementation More...
|
|
static uint64_t | bswap64 (const uint64_t &v) |
| bswap64 - generic More...
|
|
template<typename Integral > |
static unsigned | clz_template (Integral x) |
| clz (count leading zeros) - generic implementation More...
|
|
template<typename Integral > |
unsigned | clz (Integral x) |
|
template<> |
unsigned | clz< int > (int i) |
| clz (count leading zeros) More...
|
|
template<> |
unsigned | clz< unsigned > (unsigned i) |
| clz (count leading zeros) More...
|
|
template<> |
unsigned | clz< long > (long i) |
| clz (count leading zeros) More...
|
|
template<> |
unsigned | clz< unsigned long > (unsigned long i) |
| clz (count leading zeros) More...
|
|
template<> |
unsigned | clz< long long > (long long i) |
| clz (count leading zeros) More...
|
|
template<> |
unsigned | clz< unsigned long long > (unsigned long long i) |
| clz (count leading zeros) More...
|
|
template<typename Integral > |
static unsigned | ctz_template (Integral x) |
| ctz (count trailing zeros) - generic implementation More...
|
|
template<typename Integral > |
unsigned | ctz (Integral x) |
|
template<> |
unsigned | ctz< int > (int i) |
| ctz (count trailing zeros) More...
|
|
template<> |
unsigned | ctz< unsigned > (unsigned i) |
| ctz (count trailing zeros) More...
|
|
template<> |
unsigned | ctz< long > (long i) |
| ctz (count trailing zeros) More...
|
|
template<> |
unsigned | ctz< unsigned long > (unsigned long i) |
| ctz (count trailing zeros) More...
|
|
template<> |
unsigned | ctz< long long > (long long i) |
| ctz (count trailing zeros) More...
|
|
template<> |
unsigned | ctz< unsigned long long > (unsigned long long i) |
| ctz (count trailing zeros) More...
|
|
template<typename IntegralN , typename IntegralK > |
static constexpr auto | div_ceil (const IntegralN &n, const IntegralK &k) -> decltype(n+k) |
| calculate n div k with rounding up, for n and k positive! More...
|
|
template<typename Integral > |
static unsigned | ffs_template (Integral x) |
| ffs (find first set bit) - generic implementation More...
|
|
static unsigned | ffs (int i) |
| find first set bit in integer, or zero if none are set. More...
|
|
static unsigned | ffs (unsigned int i) |
| find first set bit in integer, or zero if none are set. More...
|
|
static unsigned | ffs (long i) |
| find first set bit in integer, or zero if none are set. More...
|
|
static unsigned | ffs (unsigned long i) |
| find first set bit in integer, or zero if none are set. More...
|
|
static unsigned | ffs (long long i) |
| find first set bit in integer, or zero if none are set. More...
|
|
static unsigned | ffs (unsigned long long i) |
| find first set bit in integer, or zero if none are set. More...
|
|
template<typename IntegerType > |
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_floor_template (IntegerType i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_floor (int i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_floor (unsigned int i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_floor (long i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_floor (unsigned long i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_floor (long long i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_floor (unsigned long long i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_ceil (int i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_ceil (unsigned int i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_ceil (long i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_ceil (unsigned long i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_ceil (long long i) |
| calculate the log2 floor of an integer type More...
|
|
static TLX_ADVANCED_CONSTEXPR unsigned | integer_log2_ceil (unsigned long long i) |
| calculate the log2 floor of an integer type More...
|
|
template<typename Integral > |
static bool | is_power_of_two_template (Integral i) |
|
static bool | is_power_of_two (int i) |
| does what it says: true if i is a power of two More...
|
|
static bool | is_power_of_two (unsigned int i) |
| does what it says: true if i is a power of two More...
|
|
static bool | is_power_of_two (long i) |
| does what it says: true if i is a power of two More...
|
|
static bool | is_power_of_two (unsigned long i) |
| does what it says: true if i is a power of two More...
|
|
static bool | is_power_of_two (long long i) |
| does what it says: true if i is a power of two More...
|
|
static bool | is_power_of_two (unsigned long long i) |
| does what it says: true if i is a power of two More...
|
|
static unsigned | popcount_generic8 (uint8_t x) |
| popcount (count one bits) - generic SWAR implementation More...
|
|
static unsigned | popcount_generic16 (uint16_t x) |
| popcount (count one bits) - generic SWAR implementation More...
|
|
static unsigned | popcount_generic32 (uint32_t x) |
| popcount (count one bits) - generic SWAR implementation from https://stackoverflow.com/questions/109023 More...
|
|
static unsigned | popcount_generic64 (uint64_t x) |
| popcount (count one bits) - generic SWAR implementation More...
|
|
template<typename Integral > |
unsigned | popcount (Integral i) |
| popcount (count one bits) More...
|
|
static size_t | popcount (const void *data, size_t size) |
|
template<unsigned D, typename T > |
static constexpr T | power_to_the (T x) |
| power_to_the<D>(x) More...
|
|
static uint32_t | rol32_generic (const uint32_t &x, int i) |
| rol32 - generic implementation More...
|
|
static uint32_t | rol32 (const uint32_t &x, int i) |
| rol32 - generic More...
|
|
static uint64_t | rol64_generic (const uint64_t &x, int i) |
| rol64 - generic implementation More...
|
|
static uint64_t | rol64 (const uint64_t &x, int i) |
| rol64 - generic More...
|
|
static uint32_t | ror32_generic (const uint32_t &x, int i) |
| ror32 - generic implementation More...
|
|
static uint32_t | ror32 (const uint32_t &x, int i) |
| ror32 - generic More...
|
|
static uint64_t | ror64_generic (const uint64_t &x, int i) |
| ror64 - generic implementation More...
|
|
static uint64_t | ror64 (const uint64_t &x, int i) |
| ror64 - generic More...
|
|
template<typename Integral > |
static Integral | round_up_to_power_of_two_template (Integral n) |
|
static int | round_up_to_power_of_two (int i) |
| does what it says: round up to next power of two More...
|
|
static unsigned int | round_up_to_power_of_two (unsigned int i) |
| does what it says: round up to next power of two More...
|
|
static long | round_up_to_power_of_two (long i) |
| does what it says: round up to next power of two More...
|
|
static unsigned long | round_up_to_power_of_two (unsigned long i) |
| does what it says: round up to next power of two More...
|
|
static long long | round_up_to_power_of_two (long long i) |
| does what it says: round up to next power of two More...
|
|
static unsigned long long | round_up_to_power_of_two (unsigned long long i) |
| does what it says: round up to next power of two More...
|
|
static int | round_down_to_power_of_two (int i) |
| does what it says: round down to next power of two More...
|
|
static unsigned int | round_down_to_power_of_two (unsigned int i) |
| does what it says: round down to next power of two More...
|
|
static long | round_down_to_power_of_two (long i) |
| does what it says: round down to next power of two More...
|
|
static unsigned long | round_down_to_power_of_two (unsigned long i) |
| does what it says: round down to next power of two More...
|
|
static long long | round_down_to_power_of_two (long long i) |
| does what it says: round down to next power of two More...
|
|
static unsigned long long | round_down_to_power_of_two (unsigned long long i) |
| does what it says: round down to next power of two More...
|
|
template<typename IntegralN , typename IntegralK > |
static constexpr auto | round_up (const IntegralN &n, const IntegralK &k) -> decltype(n+k) |
| round n up to the next multiple of k, for n and k positive! More...
|
|
template<typename T > |
int | sgn (const T &val) |
| sgn() - signum More...
|
|
Simple math functions.