if (a == NULL)
return NULL;
+ Assert(IsA(a, Bitmapset));
size = BITMAPSET_SIZE(a->nwords);
result = (Bitmapset *) palloc(size);
memcpy(result, a, size);
{
int i;
- Assert(a == NULL || a->words[a->nwords - 1] != 0);
- Assert(b == NULL || b->words[b->nwords - 1] != 0);
+ Assert(a == NULL || (IsA(a, Bitmapset) && a->words[a->nwords - 1] != 0));
+ Assert(b == NULL || (IsA(b, Bitmapset) && b->words[b->nwords - 1] != 0));
/* Handle cases where either input is NULL */
if (a == NULL)
{
int i;
- Assert(a == NULL || a->words[a->nwords - 1] != 0);
- Assert(b == NULL || b->words[b->nwords - 1] != 0);
+ Assert(a == NULL || (IsA(a, Bitmapset) && a->words[a->nwords - 1] != 0));
+ Assert(b == NULL || (IsA(b, Bitmapset) && b->words[b->nwords - 1] != 0));
/* Handle cases where either input is NULL */
if (a == NULL)
int otherlen;
int i;
+ Assert(a == NULL || IsA(a, Bitmapset));
+ Assert(b == NULL || IsA(b, Bitmapset));
+
/* Handle cases where either input is NULL */
if (a == NULL)
return bms_copy(b);
int resultlen;
int i;
+ Assert(a == NULL || IsA(a, Bitmapset));
+ Assert(b == NULL || IsA(b, Bitmapset));
+
/* Handle cases where either input is NULL */
if (a == NULL || b == NULL)
return NULL;
Bitmapset *result;
int i;
- Assert(a == NULL || a->words[a->nwords - 1] != 0);
- Assert(b == NULL || b->words[b->nwords - 1] != 0);
+ Assert(a == NULL || (IsA(a, Bitmapset) && a->words[a->nwords - 1] != 0));
+ Assert(b == NULL || (IsA(b, Bitmapset) && b->words[b->nwords - 1] != 0));
/* Handle cases where either input is NULL */
if (a == NULL)
if (b == NULL)
return bms_copy(a);
+ Assert(IsA(a, Bitmapset) && IsA(b, Bitmapset));
+
/*
* In Postgres' usage, an empty result is a very common case, so it's
* worth optimizing for that by testing bms_nonempty_difference(). This
{
int i;
- Assert(a == NULL || a->words[a->nwords - 1] != 0);
- Assert(b == NULL || b->words[b->nwords - 1] != 0);
+ Assert(a == NULL || (IsA(a, Bitmapset) && a->words[a->nwords - 1] != 0));
+ Assert(b == NULL || (IsA(b, Bitmapset) && b->words[b->nwords - 1] != 0));
/* Handle cases where either input is NULL */
if (a == NULL)
if (b == NULL)
return false;
+ Assert(IsA(a, Bitmapset) && IsA(b, Bitmapset));
+
/* 'a' can't be a subset of 'b' if it contains more words */
if (a->nwords > b->nwords)
return false;
int shortlen;
int i;
- Assert(a == NULL || a->words[a->nwords - 1] != 0);
- Assert(b == NULL || b->words[b->nwords - 1] != 0);
+ Assert(a == NULL || (IsA(a, Bitmapset) && a->words[a->nwords - 1] != 0));
+ Assert(b == NULL || (IsA(b, Bitmapset) && b->words[b->nwords - 1] != 0));
/* Handle cases where either input is NULL */
if (a == NULL)
}
if (b == NULL)
return BMS_SUBSET2;
+
+ Assert(IsA(a, Bitmapset) && IsA(b, Bitmapset));
+
/* Check common words */
result = BMS_EQUAL; /* status so far */
shortlen = Min(a->nwords, b->nwords);
elog(ERROR, "negative bitmapset member not allowed");
if (a == NULL)
return false;
+
+ Assert(IsA(a, Bitmapset));
+
wordnum = WORDNUM(x);
bitnum = BITNUM(x);
if (wordnum >= a->nwords)
if (!bms_is_member(x, a))
return -1;
+ Assert(IsA(a, Bitmapset));
+
wordnum = WORDNUM(x);
bitnum = BITNUM(x);
int shortlen;
int i;
+ Assert(a == NULL || IsA(a, Bitmapset));
+ Assert(b == NULL || IsA(b, Bitmapset));
+
/* Handle cases where either input is NULL */
if (a == NULL || b == NULL)
return false;
int wordnum,
bitnum;
+ Assert(a == NULL || IsA(a, Bitmapset));
+
if (a == NULL || b == NIL)
return false;
{
int i;
- Assert(a == NULL || a->words[a->nwords - 1] != 0);
- Assert(b == NULL || b->words[b->nwords - 1] != 0);
+ Assert(a == NULL || (IsA(a, Bitmapset) && a->words[a->nwords - 1] != 0));
+ Assert(b == NULL || (IsA(b, Bitmapset) && b->words[b->nwords - 1] != 0));
/* Handle cases where either input is NULL */
if (a == NULL)
if (a == NULL)
elog(ERROR, "bitmapset is empty");
+
+ Assert(IsA(a, Bitmapset));
+
nwords = a->nwords;
wordnum = 0;
do
if (a == NULL)
return false;
+ Assert(IsA(a, Bitmapset));
nwords = a->nwords;
wordnum = 0;
do
if (a == NULL)
return 0;
+ Assert(IsA(a, Bitmapset));
nwords = a->nwords;
wordnum = 0;
do
if (a == NULL)
return BMS_EMPTY_SET;
+ Assert(IsA(a, Bitmapset));
nwords = a->nwords;
wordnum = 0;
do
elog(ERROR, "negative bitmapset member not allowed");
if (a == NULL)
return bms_make_singleton(x);
+ Assert(IsA(a, Bitmapset));
wordnum = WORDNUM(x);
bitnum = BITNUM(x);
elog(ERROR, "negative bitmapset member not allowed");
if (a == NULL)
return NULL;
+
+ Assert(IsA(a, Bitmapset));
+
wordnum = WORDNUM(x);
bitnum = BITNUM(x);
int otherlen;
int i;
+ Assert(a == NULL || IsA(a, Bitmapset));
+ Assert(b == NULL || IsA(b, Bitmapset));
+
/* Handle cases where either input is NULL */
if (a == NULL)
return bms_copy(b);
ushiftbits,
wordnum;
+ Assert(a == NULL || IsA(a, Bitmapset));
+
/* do nothing if nothing is called for, without further checking */
if (upper < lower)
return a;
int shortlen;
int i;
+ Assert(a == NULL || IsA(a, Bitmapset));
+ Assert(b == NULL || IsA(b, Bitmapset));
+
/* Handle cases where either input is NULL */
if (a == NULL)
return NULL;
{
int i;
- Assert(a == NULL || a->words[a->nwords - 1] != 0);
- Assert(b == NULL || b->words[b->nwords - 1] != 0);
+ Assert(a == NULL || (IsA(a, Bitmapset) && a->words[a->nwords - 1] != 0));
+ Assert(b == NULL || (IsA(b, Bitmapset) && b->words[b->nwords - 1] != 0));
/* Handle cases where either input is NULL */
if (a == NULL)
int otherlen;
int i;
+ Assert(a == NULL || IsA(a, Bitmapset));
+ Assert(b == NULL || IsA(b, Bitmapset));
+
/* Handle cases where either input is NULL */
if (a == NULL)
return b;
int wordnum;
bitmapword mask;
+ Assert(a == NULL || IsA(a, Bitmapset));
+
if (a == NULL)
return -2;
nwords = a->nwords;
int ushiftbits;
bitmapword mask;
+ Assert(a == NULL || IsA(a, Bitmapset));
+
/*
* If set is NULL or if there are no more bits to the right then we've
* nothing to do.