18#define HAVE_BITSCAN_FORWARD
19#define HAVE_BITSCAN_REVERSE
22#if defined(HAVE__BUILTIN_CTZ)
23#define HAVE_BITSCAN_FORWARD
26#if defined(HAVE__BUILTIN_CLZ)
27#define HAVE_BITSCAN_REVERSE
43#ifdef HAVE__BUILTIN_CLZ
47#elif defined(_MSC_VER)
60 while ((
word >> shift) == 0)
74#ifdef HAVE__BUILTIN_CLZ
79#elif SIZEOF_LONG_LONG == 8
82#error "cannot find integer type of the same size as uint64_t"
85#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64))
98 while ((
word >> shift) == 0)
113#ifdef HAVE__BUILTIN_CTZ
117#elif defined(_MSC_VER)
118 unsigned long result;
130 while ((
word & 255) == 0)
147#ifdef HAVE__BUILTIN_CTZ
152#elif SIZEOF_LONG_LONG == 8
155#error "cannot find integer type of the same size as uint64_t"
158#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64))
159 unsigned long result;
171 while ((
word & 255) == 0)
198 if ((num & (num - 1)) == 0)
221 if ((num & (num - 1)) == 0)
284#ifdef HAVE_X86_64_POPCNTQ
294#elif defined(USE_NEON)
303#ifdef USE_SVE_POPCNT_WITH_RUNTIME_CHECK
336#if SIZEOF_VOID_P >= 8
367#if SIZEOF_VOID_P >= 8
391 return (
word >> n) | (
word << (32 - n));
397 return (
word << n) | (
word >> (32 - n));
402#if SIZEOF_SIZE_T == 4
403#define pg_leftmost_one_pos_size_t pg_leftmost_one_pos32
404#define pg_nextpower2_size_t pg_nextpower2_32
405#define pg_prevpower2_size_t pg_prevpower2_32
407#define pg_leftmost_one_pos_size_t pg_leftmost_one_pos64
408#define pg_nextpower2_size_t pg_nextpower2_64
409#define pg_prevpower2_size_t pg_prevpower2_64
#define Assert(condition)
uint64 pg_popcount_portable(const char *buf, int bytes)
uint64 pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask)
PGDLLIMPORT const uint8 pg_number_of_ones[256]
uint64 pg_popcount_masked_portable(const char *buf, int bytes, bits8 mask)
static uint32 pg_rotate_left32(uint32 word, int n)
static int pg_rightmost_one_pos64(uint64 word)
static uint32 pg_nextpower2_32(uint32 num)
static uint64 pg_ceil_log2_64(uint64 num)
static uint32 pg_rotate_right32(uint32 word, int n)
uint64 pg_popcount_optimized(const char *buf, int bytes)
int pg_popcount64(uint64 word)
int pg_popcount32(uint32 word)
int pg_popcount32_portable(uint32 word)
static int pg_rightmost_one_pos32(uint32 word)
static uint64 pg_nextpower2_64(uint64 num)
static int pg_leftmost_one_pos32(uint32 word)
PGDLLIMPORT const uint8 pg_rightmost_one_pos[256]
static uint32 pg_ceil_log2_32(uint32 num)
static uint64 pg_popcount(const char *buf, int bytes)
static uint32 pg_prevpower2_32(uint32 num)
static uint64 pg_prevpower2_64(uint64 num)
static uint64 pg_popcount_masked(const char *buf, int bytes, bits8 mask)
int pg_popcount64_portable(uint64 word)
PGDLLIMPORT const uint8 pg_leftmost_one_pos[256]
static int pg_leftmost_one_pos64(uint64 word)
static char buf[DEFAULT_XLOG_SEG_SIZE]
static void word(struct vars *v, int dir, struct state *lp, struct state *rp)