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

Function BIT_initCStream

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

-************************************************************** * bitStream encoding ****************************************************************/ ! BIT_initCStream() : * `dstCapacity` must be > sizeof(size_t) * @return : 0 if success, * otherwise an error code (can be tested using ERR_isError()) */

Source from the content-addressed store, hash-verified

1477 * @return : 0 if success,
1478 * otherwise an error code (can be tested using ERR_isError()) */
1479MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC,
1480 void* startPtr, size_t dstCapacity)
1481{
1482 bitC->bitContainer = 0;
1483 bitC->bitPos = 0;
1484 bitC->startPtr = (char*)startPtr;
1485 bitC->ptr = bitC->startPtr;
1486 bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer);
1487 if (dstCapacity <= sizeof(bitC->bitContainer)) return ERROR(dstSize_tooSmall);
1488 return 0;
1489}
1490
1491/*! BIT_addBits() :
1492 * can add up to 31 bits into `bitC`.

Calls

no outgoing calls

Tested by

no test coverage detected