MCPcopy Create free account
hub / github.com/F-Stack/f-stack / BIT_flushBits

Function BIT_flushBits

freebsd/contrib/openzfs/module/zstd/lib/zstd.c:1535–1545  ·  view source on GitHub ↗

! BIT_flushBits() : * assumption : bitContainer has not overflowed * safe version; check for buffer overflow, and prevents it. * note : does not signal buffer overflow. * overflow will be revealed later on using BIT_closeCStream() */

Source from the content-addressed store, hash-verified

1533 * note : does not signal buffer overflow.
1534 * overflow will be revealed later on using BIT_closeCStream() */
1535MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)
1536{
1537 size_t const nbBytes = bitC->bitPos >> 3;
1538 assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
1539 assert(bitC->ptr <= bitC->endPtr);
1540 MEM_writeLEST(bitC->ptr, bitC->bitContainer);
1541 bitC->ptr += nbBytes;
1542 if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
1543 bitC->bitPos &= 7;
1544 bitC->bitContainer >>= nbBytes*8;
1545}
1546
1547/*! BIT_closeCStream() :
1548 * @return : size of CStream, in bytes,

Callers 3

BIT_closeCStreamFunction · 0.70
FSE_flushCStateFunction · 0.70

Calls 1

MEM_writeLESTFunction · 0.70

Tested by

no test coverage detected