48#define WORDNUM(x) ((x) / BITS_PER_BITMAPWORD)
49#define BITNUM(x) ((x) % BITS_PER_BITMAPWORD)
51#define BITMAPSET_SIZE(nwords) \
52 (offsetof(Bitmapset, words) + (nwords) * sizeof(bitmapword))
71#define RIGHTMOST_ONE(x) ((signedbitmapword) (x) & -((signedbitmapword) (x)))
73#define HAS_MULTIPLE_ONES(x) ((bitmapword) RIGHTMOST_ONE(x) != (x))
75#ifdef USE_ASSERT_CHECKING
91 if (
a->words[
a->nwords - 1] == 0)
98#ifdef REALLOCATE_BITMAPSETS
161 if (
a->nwords !=
b->nwords)
168 if (
a->words[
i] !=
b->words[
i])
193 return (
b ==
NULL) ? 0 : -1;
198 if (
a->nwords !=
b->nwords)
199 return (
a->nwords >
b->nwords) ? +1 : -1;
208 return (
aw >
bw) ? +1 : -1;
224 elog(
ERROR,
"negative bitmapset member not allowed");
268 if (
a->nwords <=
b->nwords)
309 if (
a->nwords <=
b->nwords)
373 if (
result->nwords >
b->nwords)
561 if (
a->nwords >
b->nwords)
568 if ((
a->words[
i] & ~
b->words[
i]) != 0)
624 if (
a->nwords >
b->nwords)
631 else if (
a->nwords <
b->nwords)
654 elog(
ERROR,
"negative bitmapset member not allowed");
726 if ((
a->words[
i] &
b->words[
i]) != 0)
752 elog(
ERROR,
"negative bitmapset member not allowed");
782 if (
a->nwords >
b->nwords)
788 if ((
a->words[
i] & ~
b->words[
i]) != 0)
820 elog(
ERROR,
"bitmapset has multiple members");
942 elog(
ERROR,
"negative bitmapset member not allowed");
967#ifdef REALLOCATE_BITMAPSETS
995 elog(
ERROR,
"negative bitmapset member not allowed");
1002#ifdef REALLOCATE_BITMAPSETS
1018 if (
a->words[
i] != 0)
1051#ifdef REALLOCATE_BITMAPSETS
1058 if (
a->nwords <
b->nwords)
1077#ifdef REALLOCATE_BITMAPSETS
1106 if (
a->nwords <
b->nwords)
1112 a->words[
i] =
b->words[
i];
1115 a->nwords =
b->nwords;
1117#ifdef REALLOCATE_BITMAPSETS
1151#ifdef REALLOCATE_BITMAPSETS
1159 elog(
ERROR,
"negative bitmapset member not allowed");
1211#ifdef REALLOCATE_BITMAPSETS
1252 a->words[
i] &=
b->words[
i];
1254 if (
a->words[
i] != 0)
1268#ifdef REALLOCATE_BITMAPSETS
1292#ifdef REALLOCATE_BITMAPSETS
1300 if (
a->nwords >
b->nwords)
1309 a->words[
i] &=
~b->words[
i];
1320 a->words[
i] &=
~b->words[
i];
1323 if (
a->words[
i] != 0)
1338#ifdef REALLOCATE_BITMAPSETS
1362#ifdef REALLOCATE_BITMAPSETS
1370#ifdef REALLOCATE_BITMAPSETS
1378 if (
a->nwords <
b->nwords)
1398#ifdef REALLOCATE_BITMAPSETS
#define BITMAPSET_SIZE(nwords)
Bitmapset * bms_replace_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_difference(const Bitmapset *a, const Bitmapset *b)
int bms_prev_member(const Bitmapset *a, int prevbit)
Bitmapset * bms_make_singleton(int x)
Bitmapset * bms_int_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_intersect(const Bitmapset *a, const Bitmapset *b)
uint32 bitmap_hash(const void *key, Size keysize)
bool bms_equal(const Bitmapset *a, const Bitmapset *b)
BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b)
int bms_next_member(const Bitmapset *a, int prevbit)
uint32 bms_hash_value(const Bitmapset *a)
Bitmapset * bms_del_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_add_range(Bitmapset *a, int lower, int upper)
Bitmapset * bms_del_member(Bitmapset *a, int x)
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
int bms_singleton_member(const Bitmapset *a)
void bms_free(Bitmapset *a)
int bms_num_members(const Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_offset_members(const Bitmapset *a, int offset)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
#define HAS_MULTIPLE_ONES(x)
int bitmap_match(const void *key1, const void *key2, Size keysize)
BMS_Membership bms_membership(const Bitmapset *a)
int bms_member_index(Bitmapset *a, int x)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
int bms_compare(const Bitmapset *a, const Bitmapset *b)
bool bms_get_singleton_member(const Bitmapset *a, int *member)
Bitmapset * bms_join(Bitmapset *a, Bitmapset *b)
bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_copy(const Bitmapset *a)
bool bms_overlap_list(const Bitmapset *a, const List *b)
#define bmw_rightmost_one_pos(w)
#define bmw_leftmost_one_pos(w)
#define BITS_PER_BITMAPWORD
#define Assert(condition)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
static Datum hash_any(const unsigned char *k, int keylen)
static bool pg_add_s32_overflow(int32 a, int32 b, int32 *result)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
void * palloc0(Size size)
#define IsA(nodeptr, _type_)
Datum lower(PG_FUNCTION_ARGS)
Datum upper(PG_FUNCTION_ARGS)
static uint64 pg_popcount(const char *buf, int bytes)
static uint32 DatumGetUInt32(Datum X)