35#pragma GCC diagnostic push
36#pragma GCC diagnostic ignored "-Wconversion"
37#pragma GCC diagnostic ignored "-Wsign-conversion"
38#pragma GCC diagnostic ignored "-Wunused-parameter"
39#pragma GCC diagnostic ignored "-Wunused-variable"
40#pragma GCC diagnostic ignored "-Wsign-compare"
41#pragma GCC diagnostic ignored "-Wparentheses"
44#define round_up(x, n) (((x) + (n)-1) & (-n))
45#define round_down(x, n) ((x) & (-n))
46#define ceil_int(a, b) ((a) + ((b)-1)) / (b)
48#if defined(__arm64__) || defined(__arm__) || defined(__aarch64__)
50 #if defined(__ARM_NEON__)
53#elif defined(_MSC_VER) || defined(__MINGW64__)
56 #include <x86intrin.h>
62 precision = __popcnt(
static_cast<uint32_t
>(num));
63#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
64 precision = _popcnt32(num);
76static inline uint32_t
int_log2(
const uint32_t x) {
80 _BitScanReverse(&tmp, x);
83 y = 31 - __builtin_clz(x);
85 return (x == 0) ? 0 : y;
92#elif defined(__AVX2__)
94#elif defined(__MINGW32__) || defined(__MINGW64__)
96#elif defined(__ARM_FEATURE_CLZ)
101 return (x == 0) ? 31 : y;
105#pragma GCC diagnostic pop
static uint32_t int_log2(const uint32_t x)
Definition utils.hpp:76
static uint32_t count_leading_zeros(const uint32_t x)
Definition utils.hpp:88
static size_t popcount32(uintmax_t num)
Definition utils.hpp:59