| 328 | } |
| 329 | |
| 330 | static inline void |
| 331 | DatumStreamBitMapWrite_ZeroFill( |
| 332 | DatumStreamBitMapWrite * bmw, |
| 333 | int32 bitCount) |
| 334 | { |
| 335 | int32 newSize; |
| 336 | int32 bitNumberInByte; |
| 337 | |
| 338 | /* |
| 339 | * Assert the bit-map is newly initialized. |
| 340 | */ |
| 341 | Assert(bmw->byteBit == 0); |
| 342 | Assert(bmw->bitOnCount == 0); |
| 343 | Assert(bmw->bitCount == 0); |
| 344 | |
| 345 | if (bitCount > 0) |
| 346 | { |
| 347 | /* |
| 348 | * Assert we are not going beyond the maximum buffer size. |
| 349 | */ |
| 350 | newSize = DatumStreamBitMap_Size(bitCount); |
| 351 | #ifdef USE_ASSERT_CHECKING |
| 352 | if (newSize > bmw->bufferSize) |
| 353 | { |
| 354 | elog(ERROR, |
| 355 | "New fill bit-map buffer size %d greater than maximum buffer size %d", |
| 356 | newSize, |
| 357 | bmw->bufferSize); |
| 358 | } |
| 359 | #endif |
| 360 | |
| 361 | /* |
| 362 | * Zero fill out and set the write variables. |
| 363 | */ |
| 364 | memset(bmw->buffer, 0, newSize); |
| 365 | |
| 366 | bitNumberInByte = (bitCount - 1) & 7; |
| 367 | bmw->byteBit = 1 << bitNumberInByte; |
| 368 | |
| 369 | bmw->bytePointer = &bmw->buffer[newSize - 1]; |
| 370 | |
| 371 | bmw->bitCount = bitCount; |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | static inline void |
| 376 | DatumStreamBitMapWrite_AddBit( |
no test coverage detected