47#define WORDNUM(x) ((x) / BITS_PER_BITMAPWORD)
48#define BITNUM(x) ((x) % BITS_PER_BITMAPWORD)
50#define BITMAPSET_SIZE(nwords) \
51 (offsetof(Bitmapset, words) + (nwords) * sizeof(bitmapword))
70#define RIGHTMOST_ONE(x) ((signedbitmapword) (x) & -((signedbitmapword) (x)))
72#define HAS_MULTIPLE_ONES(x) ((bitmapword) RIGHTMOST_ONE(x) != (x))
74#ifdef USE_ASSERT_CHECKING
90 if (
a->words[
a->nwords - 1] == 0)
97#ifdef REALLOCATE_BITMAPSETS
160 if (
a->nwords !=
b->nwords)
167 if (
a->words[
i] !=
b->words[
i])
192 return (
b ==
NULL) ? 0 : -1;
197 if (
a->nwords !=
b->nwords)
198 return (
a->nwords >
b->nwords) ? +1 : -1;
207 return (
aw >
bw) ? +1 : -1;
223 elog(
ERROR,
"negative bitmapset member not allowed");
267 if (
a->nwords <=
b->nwords)
308 if (
a->nwords <=
b->nwords)
326 if (result->
words[
i] != 0)
372 if (result->
nwords >
b->nwords)
395 if (result->
words[
i] != 0)
426 if (
a->nwords >
b->nwords)
433 if ((
a->words[
i] & ~
b->words[
i]) != 0)
489 if (
a->nwords >
b->nwords)
496 else if (
a->nwords <
b->nwords)
519 elog(
ERROR,
"negative bitmapset member not allowed");
597 if ((
a->words[
i] &
b->words[
i]) != 0)
623 elog(
ERROR,
"negative bitmapset member not allowed");
653 if (
a->nwords >
b->nwords)
659 if ((
a->words[
i] & ~
b->words[
i]) != 0)
691 elog(
ERROR,
"bitmapset has multiple members");
822 elog(
ERROR,
"negative bitmapset member not allowed");
847#ifdef REALLOCATE_BITMAPSETS
875 elog(
ERROR,
"negative bitmapset member not allowed");
882#ifdef REALLOCATE_BITMAPSETS
898 if (
a->words[
i] != 0)
931#ifdef REALLOCATE_BITMAPSETS
938 if (
a->nwords <
b->nwords)
957#ifdef REALLOCATE_BITMAPSETS
986 if (
a->nwords <
b->nwords)
992 a->words[
i] =
b->words[
i];
995 a->nwords =
b->nwords;
997#ifdef REALLOCATE_BITMAPSETS
1031#ifdef REALLOCATE_BITMAPSETS
1039 elog(
ERROR,
"negative bitmapset member not allowed");
1091#ifdef REALLOCATE_BITMAPSETS
1132 a->words[
i] &=
b->words[
i];
1134 if (
a->words[
i] != 0)
1148#ifdef REALLOCATE_BITMAPSETS
1172#ifdef REALLOCATE_BITMAPSETS
1180 if (
a->nwords >
b->nwords)
1189 a->words[
i] &=
~b->words[
i];
1200 a->words[
i] &=
~b->words[
i];
1203 if (
a->words[
i] != 0)
1218#ifdef REALLOCATE_BITMAPSETS
1242#ifdef REALLOCATE_BITMAPSETS
1250#ifdef REALLOCATE_BITMAPSETS
1258 if (
a->nwords <
b->nwords)
1275 if (
other != result)
1278#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_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)
static Datum hash_any(const unsigned char *k, int keylen)
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 uint32 DatumGetUInt32(Datum X)
bitmapword words[FLEXIBLE_ARRAY_MEMBER]