PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pg_bitutils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define pg_leftmost_one_pos_size_t   pg_leftmost_one_pos64
 
#define pg_nextpower2_size_t   pg_nextpower2_64
 
#define pg_prevpower2_size_t   pg_prevpower2_64
 

Functions

static int pg_leftmost_one_pos32 (uint32 word)
 
static int pg_leftmost_one_pos64 (uint64 word)
 
static int pg_rightmost_one_pos32 (uint32 word)
 
static int pg_rightmost_one_pos64 (uint64 word)
 
static uint32 pg_nextpower2_32 (uint32 num)
 
static uint64 pg_nextpower2_64 (uint64 num)
 
static uint32 pg_prevpower2_32 (uint32 num)
 
static uint64 pg_prevpower2_64 (uint64 num)
 
static uint32 pg_ceil_log2_32 (uint32 num)
 
static uint64 pg_ceil_log2_64 (uint64 num)
 
int pg_popcount32_portable (uint32 word)
 
int pg_popcount64_portable (uint64 word)
 
uint64 pg_popcount_portable (const char *buf, int bytes)
 
uint64 pg_popcount_masked_portable (const char *buf, int bytes, bits8 mask)
 
int pg_popcount32 (uint32 word)
 
int pg_popcount64 (uint64 word)
 
uint64 pg_popcount_optimized (const char *buf, int bytes)
 
uint64 pg_popcount_masked_optimized (const char *buf, int bytes, bits8 mask)
 
static uint64 pg_popcount (const char *buf, int bytes)
 
static uint64 pg_popcount_masked (const char *buf, int bytes, bits8 mask)
 
static uint32 pg_rotate_right32 (uint32 word, int n)
 
static uint32 pg_rotate_left32 (uint32 word, int n)
 

Variables

PGDLLIMPORT const uint8 pg_leftmost_one_pos [256]
 
PGDLLIMPORT const uint8 pg_rightmost_one_pos [256]
 
PGDLLIMPORT const uint8 pg_number_of_ones [256]
 

Macro Definition Documentation

◆ pg_leftmost_one_pos_size_t

#define pg_leftmost_one_pos_size_t   pg_leftmost_one_pos64

Definition at line 407 of file pg_bitutils.h.

◆ pg_nextpower2_size_t

#define pg_nextpower2_size_t   pg_nextpower2_64

Definition at line 408 of file pg_bitutils.h.

◆ pg_prevpower2_size_t

#define pg_prevpower2_size_t   pg_prevpower2_64

Definition at line 409 of file pg_bitutils.h.

Function Documentation

◆ pg_ceil_log2_32()

static uint32 pg_ceil_log2_32 ( uint32  num)
inlinestatic

Definition at line 258 of file pg_bitutils.h.

259{
260 if (num < 2)
261 return 0;
262 else
263 return pg_leftmost_one_pos32(num - 1) + 1;
264}
static int pg_leftmost_one_pos32(uint32 word)
Definition pg_bitutils.h:41

References pg_leftmost_one_pos32().

Referenced by _hash_spareindex(), ExecHashTableCreate(), ExecParallelHashTableSetCurrentBatch(), hash_choose_num_partitions(), MultiExecParallelHash(), and subxact_info_read().

◆ pg_ceil_log2_64()

static uint64 pg_ceil_log2_64 ( uint64  num)
inlinestatic

Definition at line 271 of file pg_bitutils.h.

272{
273 if (num < 2)
274 return 0;
275 else
276 return pg_leftmost_one_pos64(num - 1) + 1;
277}
static int pg_leftmost_one_pos64(uint64 word)
Definition pg_bitutils.h:72

References pg_leftmost_one_pos64().

Referenced by GetHugePageSize(), and my_log2().

◆ pg_leftmost_one_pos32()

static int pg_leftmost_one_pos32 ( uint32  word)
inlinestatic

Definition at line 41 of file pg_bitutils.h.

42{
43#ifdef HAVE__BUILTIN_CLZ
44 Assert(word != 0);
45
46 return 31 - __builtin_clz(word);
47#elif defined(_MSC_VER)
48 unsigned long result;
49 bool non_zero;
50
51 Assert(word != 0);
52
53 non_zero = _BitScanReverse(&result, word);
54 return (int) result;
55#else
56 int shift = 32 - 8;
57
58 Assert(word != 0);
59
60 while ((word >> shift) == 0)
61 shift -= 8;
62
63 return shift + pg_leftmost_one_pos[(word >> shift) & 255];
64#endif /* HAVE__BUILTIN_CLZ */
65}
#define Assert(condition)
Definition c.h:873
PGDLLIMPORT const uint8 pg_leftmost_one_pos[256]
Definition pg_bitutils.c:27
static int fb(int x)
static void word(struct vars *v, int dir, struct state *lp, struct state *rp)
Definition regcomp.c:1476

References Assert, fb(), pg_leftmost_one_pos, and word().

Referenced by _hash_get_oldblock_from_newbucket(), _hash_init_metabuffer(), add_paths_to_append_rel(), AllocSetFreeIndex(), decimalLength32(), generate_union_paths(), make_main_region_dsm_handle(), pg_ceil_log2_32(), pg_nextpower2_32(), pg_prevpower2_32(), rho(), and test_timing().

◆ pg_leftmost_one_pos64()

static int pg_leftmost_one_pos64 ( uint64  word)
inlinestatic

Definition at line 72 of file pg_bitutils.h.

73{
74#ifdef HAVE__BUILTIN_CLZ
75 Assert(word != 0);
76
77#if SIZEOF_LONG == 8
78 return 63 - __builtin_clzl(word);
79#elif SIZEOF_LONG_LONG == 8
80 return 63 - __builtin_clzll(word);
81#else
82#error "cannot find integer type of the same size as uint64_t"
83#endif
84
85#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64))
86 unsigned long result;
87 bool non_zero;
88
89 Assert(word != 0);
90
92 return (int) result;
93#else
94 int shift = 64 - 8;
95
96 Assert(word != 0);
97
98 while ((word >> shift) == 0)
99 shift -= 8;
100
101 return shift + pg_leftmost_one_pos[(word >> shift) & 255];
102#endif /* HAVE__BUILTIN_CLZ */
103}

References Assert, fb(), pg_leftmost_one_pos, and word().

Referenced by decimalLength64(), permute(), pg_ceil_log2_64(), pg_nextpower2_64(), pg_prevpower2_64(), pg_prng_uint64_range(), and RT_KEY_GET_SHIFT().

◆ pg_nextpower2_32()

static uint32 pg_nextpower2_32 ( uint32  num)
inlinestatic

Definition at line 189 of file pg_bitutils.h.

190{
191 Assert(num > 0 && num <= PG_UINT32_MAX / 2 + 1);
192
193 /*
194 * A power 2 number has only 1 bit set. Subtracting 1 from such a number
195 * will turn on all previous bits resulting in no common bits being set
196 * between num and num-1.
197 */
198 if ((num & (num - 1)) == 0)
199 return num; /* already power 2 */
200
201 return ((uint32) 1) << (pg_leftmost_one_pos32(num) + 1);
202}
#define PG_UINT32_MAX
Definition c.h:604
uint32_t uint32
Definition c.h:546

References Assert, pg_leftmost_one_pos32(), and PG_UINT32_MAX.

Referenced by _h_spoolinit(), _hash_init_metabuffer(), accumArrayResultArr(), addlit(), array_agg_array_combine(), array_agg_combine(), bottomup_sort_and_shrink(), bottomup_sort_and_shrink_cmp(), enlarge_list(), ensure_record_cache_typmod_slot_exists(), ExecChooseHashTableSize(), ExecHashBuildSkewHash(), ExecParallelHashIncreaseNumBatches(), GetExplainExtensionId(), GetPlannerExtensionId(), ginHeapTupleFastCollect(), InitializeFastPathLocks(), new_list(), pgaio_worker_queue_shmem_size(), RegisterExtensionExplainOption(), RequestNamedLWLockTranche(), SetExplainExtensionState(), SetPlannerGlobalExtensionState(), SetPlannerInfoExtensionState(), SetRelOptInfoExtensionState(), and table_block_parallelscan_startblock_init().

◆ pg_nextpower2_64()

static uint64 pg_nextpower2_64 ( uint64  num)
inlinestatic

Definition at line 212 of file pg_bitutils.h.

213{
214 Assert(num > 0 && num <= PG_UINT64_MAX / 2 + 1);
215
216 /*
217 * A power 2 number has only 1 bit set. Subtracting 1 from such a number
218 * will turn on all previous bits resulting in no common bits being set
219 * between num and num-1.
220 */
221 if ((num & (num - 1)) == 0)
222 return num; /* already power 2 */
223
224 return ((uint64) 1) << (pg_leftmost_one_pos64(num) + 1);
225}
uint64_t uint64
Definition c.h:547
#define PG_UINT64_MAX
Definition c.h:607

References Assert, pg_leftmost_one_pos64(), and PG_UINT64_MAX.

◆ pg_popcount()

static uint64 pg_popcount ( const char buf,
int  bytes 
)
inlinestatic

Definition at line 330 of file pg_bitutils.h.

331{
332 /*
333 * We set the threshold to the point at which we'll first use special
334 * instructions in the optimized version.
335 */
336#if SIZEOF_VOID_P >= 8
337 int threshold = 8;
338#else
339 int threshold = 4;
340#endif
341
342 if (bytes < threshold)
343 {
344 uint64 popcnt = 0;
345
346 while (bytes--)
347 popcnt += pg_number_of_ones[(unsigned char) *buf++];
348 return popcnt;
349 }
350
351 return pg_popcount_optimized(buf, bytes);
352}
PGDLLIMPORT const uint8 pg_number_of_ones[256]
Definition pg_bitutils.c:80
uint64 pg_popcount_optimized(const char *buf, int bytes)
static char buf[DEFAULT_XLOG_SEG_SIZE]

References buf, fb(), pg_number_of_ones, and pg_popcount_optimized().

Referenced by bit_bit_count(), bloom_prop_bits_set(), brin_bloom_union(), bytea_bit_count(), GetWALBlockInfo(), heap_tuple_infomask_flags(), sizebitvec(), sizebitvec(), sizebitvec(), and sizebitvec().

◆ pg_popcount32()

int pg_popcount32 ( uint32  word)
extern

Definition at line 254 of file pg_bitutils.c.

255{
257}
int pg_popcount32_portable(uint32 word)

References pg_popcount32_portable(), and word().

Referenced by plan_single_revoke().

◆ pg_popcount32_portable()

int pg_popcount32_portable ( uint32  word)
extern

Definition at line 104 of file pg_bitutils.c.

105{
106#ifdef HAVE__BUILTIN_POPCOUNT
107 return __builtin_popcount(word);
108#else /* !HAVE__BUILTIN_POPCOUNT */
109 int result = 0;
110
111 while (word != 0)
112 {
113 result += pg_number_of_ones[word & 255];
114 word >>= 8;
115 }
116
117 return result;
118#endif /* HAVE__BUILTIN_POPCOUNT */
119}
const uint8 pg_number_of_ones[256]
Definition pg_bitutils.c:80

References fb(), pg_number_of_ones, and word().

Referenced by pg_popcount32(), pg_popcount_masked_portable(), and pg_popcount_portable().

◆ pg_popcount64()

int pg_popcount64 ( uint64  word)
extern

Definition at line 260 of file pg_bitutils.c.

261{
263}
int pg_popcount64_portable(uint64 word)

References pg_popcount64_portable(), and word().

Referenced by select_best_grantor().

◆ pg_popcount64_portable()

int pg_popcount64_portable ( uint64  word)
extern

Definition at line 126 of file pg_bitutils.c.

127{
128#ifdef HAVE__BUILTIN_POPCOUNT
129#if SIZEOF_LONG == 8
131#elif SIZEOF_LONG_LONG == 8
133#else
134#error "cannot find integer of the same size as uint64_t"
135#endif
136#else /* !HAVE__BUILTIN_POPCOUNT */
137 int result = 0;
138
139 while (word != 0)
140 {
141 result += pg_number_of_ones[word & 255];
142 word >>= 8;
143 }
144
145 return result;
146#endif /* HAVE__BUILTIN_POPCOUNT */
147}

References fb(), pg_number_of_ones, and word().

Referenced by pg_popcount64(), pg_popcount_masked_portable(), and pg_popcount_portable().

◆ pg_popcount_masked()

static uint64 pg_popcount_masked ( const char buf,
int  bytes,
bits8  mask 
)
inlinestatic

Definition at line 361 of file pg_bitutils.h.

362{
363 /*
364 * We set the threshold to the point at which we'll first use special
365 * instructions in the optimized version.
366 */
367#if SIZEOF_VOID_P >= 8
368 int threshold = 8;
369#else
370 int threshold = 4;
371#endif
372
373 if (bytes < threshold)
374 {
375 uint64 popcnt = 0;
376
377 while (bytes--)
378 popcnt += pg_number_of_ones[(unsigned char) *buf++ & mask];
379 return popcnt;
380 }
381
382 return pg_popcount_masked_optimized(buf, bytes, mask);
383}
uint64 pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask)

References buf, fb(), pg_number_of_ones, and pg_popcount_masked_optimized().

Referenced by visibilitymap_count().

◆ pg_popcount_masked_optimized()

uint64 pg_popcount_masked_optimized ( const char buf,
int  bytes,
bits8  mask 
)
extern

Definition at line 280 of file pg_bitutils.c.

281{
282 return pg_popcount_masked_portable(buf, bytes, mask);
283}
uint64 pg_popcount_masked_portable(const char *buf, int bytes, bits8 mask)

References buf, and pg_popcount_masked_portable().

Referenced by pg_popcount_masked().

◆ pg_popcount_masked_portable()

uint64 pg_popcount_masked_portable ( const char buf,
int  bytes,
bits8  mask 
)
extern

Definition at line 200 of file pg_bitutils.c.

201{
202 uint64 popcnt = 0;
203
204#if SIZEOF_VOID_P >= 8
205 /* Process in 64-bit chunks if the buffer is aligned */
206 uint64 maskv = ~UINT64CONST(0) / 0xFF * mask;
207
208 if (buf == (const char *) TYPEALIGN(8, buf))
209 {
210 const uint64 *words = (const uint64 *) buf;
211
212 while (bytes >= 8)
213 {
214 popcnt += pg_popcount64_portable(*words++ & maskv);
215 bytes -= 8;
216 }
217
218 buf = (const char *) words;
219 }
220#else
221 /* Process in 32-bit chunks if the buffer is aligned. */
222 uint32 maskv = ~((uint32) 0) / 0xFF * mask;
223
224 if (buf == (const char *) TYPEALIGN(4, buf))
225 {
226 const uint32 *words = (const uint32 *) buf;
227
228 while (bytes >= 4)
229 {
230 popcnt += pg_popcount32_portable(*words++ & maskv);
231 bytes -= 4;
232 }
233
234 buf = (const char *) words;
235 }
236#endif
237
238 /* Process any remaining bytes */
239 while (bytes--)
240 popcnt += pg_number_of_ones[(unsigned char) *buf++ & mask];
241
242 return popcnt;
243}
#define TYPEALIGN(ALIGNVAL, LEN)
Definition c.h:819

References buf, fb(), pg_number_of_ones, pg_popcount32_portable(), pg_popcount64_portable(), and TYPEALIGN.

Referenced by pg_popcount_masked_optimized().

◆ pg_popcount_optimized()

uint64 pg_popcount_optimized ( const char buf,
int  bytes 
)
extern

Definition at line 270 of file pg_bitutils.c.

271{
272 return pg_popcount_portable(buf, bytes);
273}
uint64 pg_popcount_portable(const char *buf, int bytes)

References buf, and pg_popcount_portable().

Referenced by pg_popcount().

◆ pg_popcount_portable()

uint64 pg_popcount_portable ( const char buf,
int  bytes 
)
extern

Definition at line 154 of file pg_bitutils.c.

155{
156 uint64 popcnt = 0;
157
158#if SIZEOF_VOID_P >= 8
159 /* Process in 64-bit chunks if the buffer is aligned. */
160 if (buf == (const char *) TYPEALIGN(8, buf))
161 {
162 const uint64 *words = (const uint64 *) buf;
163
164 while (bytes >= 8)
165 {
166 popcnt += pg_popcount64_portable(*words++);
167 bytes -= 8;
168 }
169
170 buf = (const char *) words;
171 }
172#else
173 /* Process in 32-bit chunks if the buffer is aligned. */
174 if (buf == (const char *) TYPEALIGN(4, buf))
175 {
176 const uint32 *words = (const uint32 *) buf;
177
178 while (bytes >= 4)
179 {
180 popcnt += pg_popcount32_portable(*words++);
181 bytes -= 4;
182 }
183
184 buf = (const char *) words;
185 }
186#endif
187
188 /* Process any remaining bytes */
189 while (bytes--)
190 popcnt += pg_number_of_ones[(unsigned char) *buf++];
191
192 return popcnt;
193}

References buf, fb(), pg_number_of_ones, pg_popcount32_portable(), pg_popcount64_portable(), and TYPEALIGN.

Referenced by pg_popcount_optimized().

◆ pg_prevpower2_32()

static uint32 pg_prevpower2_32 ( uint32  num)
inlinestatic

Definition at line 235 of file pg_bitutils.h.

236{
237 return ((uint32) 1) << pg_leftmost_one_pos32(num);
238}

References pg_leftmost_one_pos32().

Referenced by ExecParallelHashIncreaseNumBatches().

◆ pg_prevpower2_64()

static uint64 pg_prevpower2_64 ( uint64  num)
inlinestatic

Definition at line 248 of file pg_bitutils.h.

249{
250 return ((uint64) 1) << pg_leftmost_one_pos64(num);
251}

References pg_leftmost_one_pos64().

◆ pg_rightmost_one_pos32()

static int pg_rightmost_one_pos32 ( uint32  word)
inlinestatic

Definition at line 111 of file pg_bitutils.h.

112{
113#ifdef HAVE__BUILTIN_CTZ
114 Assert(word != 0);
115
116 return __builtin_ctz(word);
117#elif defined(_MSC_VER)
118 unsigned long result;
119 bool non_zero;
120
121 Assert(word != 0);
122
123 non_zero = _BitScanForward(&result, word);
124 return (int) result;
125#else
126 int result = 0;
127
128 Assert(word != 0);
129
130 while ((word & 255) == 0)
131 {
132 word >>= 8;
133 result += 8;
134 }
135 result += pg_rightmost_one_pos[word & 255];
136 return result;
137#endif /* HAVE__BUILTIN_CTZ */
138}
PGDLLIMPORT const uint8 pg_rightmost_one_pos[256]
Definition pg_bitutils.c:55

References Assert, fb(), pg_rightmost_one_pos, and word().

Referenced by ProcessProcSignalBarrier(), RT_NODE_16_GET_INSERTPOS(), and RT_NODE_16_SEARCH_EQ().

◆ pg_rightmost_one_pos64()

static int pg_rightmost_one_pos64 ( uint64  word)
inlinestatic

Definition at line 145 of file pg_bitutils.h.

146{
147#ifdef HAVE__BUILTIN_CTZ
148 Assert(word != 0);
149
150#if SIZEOF_LONG == 8
151 return __builtin_ctzl(word);
152#elif SIZEOF_LONG_LONG == 8
153 return __builtin_ctzll(word);
154#else
155#error "cannot find integer type of the same size as uint64_t"
156#endif
157
158#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64))
159 unsigned long result;
160 bool non_zero;
161
162 Assert(word != 0);
163
164 non_zero = _BitScanForward64(&result, word);
165 return (int) result;
166#else
167 int result = 0;
168
169 Assert(word != 0);
170
171 while ((word & 255) == 0)
172 {
173 word >>= 8;
174 result += 8;
175 }
176 result += pg_rightmost_one_pos[word & 255];
177 return result;
178#endif /* HAVE__BUILTIN_CTZ */
179}

References Assert, fb(), pg_rightmost_one_pos, and word().

Referenced by pgaio_worker_choose_idle().

◆ pg_rotate_left32()

static uint32 pg_rotate_left32 ( uint32  word,
int  n 
)
inlinestatic

◆ pg_rotate_right32()

static uint32 pg_rotate_right32 ( uint32  word,
int  n 
)
inlinestatic

Definition at line 389 of file pg_bitutils.h.

390{
391 return (word >> n) | (word << (32 - n));
392}

References word().

Referenced by ExecHashGetBucketAndBatch().

Variable Documentation

◆ pg_leftmost_one_pos

PGDLLIMPORT const uint8 pg_leftmost_one_pos[256]
extern

Definition at line 27 of file pg_bitutils.c.

27 {
28 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
29 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
30 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
31 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
32 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
33 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
34 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
35 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
36 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
37 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
38 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
39 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
40 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
41 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
42 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
43 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
44};

Referenced by AllocSetFreeIndex(), pg_leftmost_one_pos32(), and pg_leftmost_one_pos64().

◆ pg_number_of_ones

PGDLLIMPORT const uint8 pg_number_of_ones[256]
extern

Definition at line 80 of file pg_bitutils.c.

80 {
81 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
82 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
83 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
84 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
85 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
86 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
87 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
88 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
89 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
90 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
91 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
92 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
93 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
94 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
95 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
96 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
97};

Referenced by hemdistsign(), hemdistsign(), hemdistsign(), hemdistsign(), pg_popcount(), pg_popcount32_portable(), pg_popcount64_portable(), pg_popcount_masked(), pg_popcount_masked_portable(), pg_popcount_portable(), and process_pipe_input().

◆ pg_rightmost_one_pos

PGDLLIMPORT const uint8 pg_rightmost_one_pos[256]
extern

Definition at line 55 of file pg_bitutils.c.

55 {
56 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
57 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
58 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
59 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
60 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
61 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
62 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
63 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
64 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
65 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
66 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
67 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
68 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
69 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
70 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
71 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
72};

Referenced by pg_rightmost_one_pos32(), and pg_rightmost_one_pos64().