MCPcopy Create free account
hub / github.com/apache/cloudberry / DatumStreamBitMapWrite_ZeroFill

Function DatumStreamBitMapWrite_ZeroFill

src/include/utils/datumstreamblock.h:330–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330static inline void
331DatumStreamBitMapWrite_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
375static inline void
376DatumStreamBitMapWrite_AddBit(

Calls 1

DatumStreamBitMap_SizeFunction · 0.85

Tested by

no test coverage detected