Move some bitmap logic out of bitmapset.c
Move the logic for selecting appropriate pg_bitutils.h functions based on word size to bitmapset.h for wider visibility. Reviewed (in a previous version) by Tom Lane Discussion: https://postgr.es/m/CAFBsxsFW2JjTo58jtDB%2B3sZhxMx3t-3evew8%3DAcr%2BGGhC%2BkFaA%40mail.gmail.com
This commit is contained in:
parent
9f225e992b
commit
3e76a806cb
@ -71,19 +71,6 @@
|
|||||||
|
|
||||||
#define HAS_MULTIPLE_ONES(x) ((bitmapword) RIGHTMOST_ONE(x) != (x))
|
#define HAS_MULTIPLE_ONES(x) ((bitmapword) RIGHTMOST_ONE(x) != (x))
|
||||||
|
|
||||||
/* Select appropriate bit-twiddling functions for bitmap word size */
|
|
||||||
#if BITS_PER_BITMAPWORD == 32
|
|
||||||
#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos32(w)
|
|
||||||
#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos32(w)
|
|
||||||
#define bmw_popcount(w) pg_popcount32(w)
|
|
||||||
#elif BITS_PER_BITMAPWORD == 64
|
|
||||||
#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos64(w)
|
|
||||||
#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos64(w)
|
|
||||||
#define bmw_popcount(w) pg_popcount64(w)
|
|
||||||
#else
|
|
||||||
#error "invalid BITS_PER_BITMAPWORD"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_ASSERT_CHECKING
|
#ifdef USE_ASSERT_CHECKING
|
||||||
/*
|
/*
|
||||||
* bms_is_valid_set - for cassert builds to check for valid sets
|
* bms_is_valid_set - for cassert builds to check for valid sets
|
||||||
|
@ -73,6 +73,19 @@ typedef enum
|
|||||||
BMS_MULTIPLE, /* >1 member */
|
BMS_MULTIPLE, /* >1 member */
|
||||||
} BMS_Membership;
|
} BMS_Membership;
|
||||||
|
|
||||||
|
/* Select appropriate bit-twiddling functions for bitmap word size */
|
||||||
|
#if BITS_PER_BITMAPWORD == 32
|
||||||
|
#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos32(w)
|
||||||
|
#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos32(w)
|
||||||
|
#define bmw_popcount(w) pg_popcount32(w)
|
||||||
|
#elif BITS_PER_BITMAPWORD == 64
|
||||||
|
#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos64(w)
|
||||||
|
#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos64(w)
|
||||||
|
#define bmw_popcount(w) pg_popcount64(w)
|
||||||
|
#else
|
||||||
|
#error "invalid BITS_PER_BITMAPWORD"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* function prototypes in nodes/bitmapset.c
|
* function prototypes in nodes/bitmapset.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user