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

Function BIT_addBits

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

! BIT_addBits() : * can add up to 31 bits into `bitC`. * Note : does not check for register overflow ! */

Source from the content-addressed store, hash-verified

1492 * can add up to 31 bits into `bitC`.
1493 * Note : does not check for register overflow ! */
1494MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC,
1495 size_t value, unsigned nbBits)
1496{
1497 MEM_STATIC_ASSERT(BIT_MASK_SIZE == 32);
1498 assert(nbBits < BIT_MASK_SIZE);
1499 assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
1500 bitC->bitContainer |= (value & BIT_mask[nbBits]) << bitC->bitPos;
1501 bitC->bitPos += nbBits;
1502}
1503
1504/*! BIT_addBitsFast() :
1505 * works only if `value` is _clean_,

Callers 3

FSE_encodeSymbolFunction · 0.70
FSE_flushCStateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected