* bms_make_singleton - build a bitmapset containing a single member */
| 180 | * bms_make_singleton - build a bitmapset containing a single member |
| 181 | */ |
| 182 | Bitmapset * |
| 183 | bms_make_singleton(int x) |
| 184 | { |
| 185 | Bitmapset *result; |
| 186 | int wordnum, |
| 187 | bitnum; |
| 188 | |
| 189 | if (x < 0) |
| 190 | elog(ERROR, "negative bitmapset member not allowed"); |
| 191 | wordnum = WORDNUM(x); |
| 192 | bitnum = BITNUM(x); |
| 193 | result = (Bitmapset *) palloc0(BITMAPSET_SIZE(wordnum + 1)); |
| 194 | result->nwords = wordnum + 1; |
| 195 | result->words[wordnum] = ((bitmapword) 1 << bitnum); |
| 196 | return result; |
| 197 | } |
| 198 | |
| 199 | /* |
| 200 | * bms_free - free a bitmapset |