Lines Matching refs:bitC
78 ZSTD_STATIC size_t BIT_initCStream(BIT_CStream_t *bitC, void *dstBuffer, size_t dstCapacity);
79 ZSTD_STATIC void BIT_addBits(BIT_CStream_t *bitC, size_t value, unsigned nbBits);
80 ZSTD_STATIC void BIT_flushBits(BIT_CStream_t *bitC);
81 ZSTD_STATIC size_t BIT_closeCStream(BIT_CStream_t *bitC);
136 ZSTD_STATIC void BIT_addBitsFast(BIT_CStream_t *bitC, size_t value, unsigned nbBits);
139 ZSTD_STATIC void BIT_flushBitsFast(BIT_CStream_t *bitC);
162 ZSTD_STATIC size_t BIT_initCStream(BIT_CStream_t *bitC, void *startPtr, size_t dstCapacity) in BIT_initCStream() argument
164 bitC->bitContainer = 0; in BIT_initCStream()
165 bitC->bitPos = 0; in BIT_initCStream()
166 bitC->startPtr = (char *)startPtr; in BIT_initCStream()
167 bitC->ptr = bitC->startPtr; in BIT_initCStream()
168 bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->ptr); in BIT_initCStream()
169 if (dstCapacity <= sizeof(bitC->ptr)) in BIT_initCStream()
177 ZSTD_STATIC void BIT_addBits(BIT_CStream_t *bitC, size_t value, unsigned nbBits) in BIT_addBits() argument
179 bitC->bitContainer |= (value & BIT_mask[nbBits]) << bitC->bitPos; in BIT_addBits()
180 bitC->bitPos += nbBits; in BIT_addBits()
185 ZSTD_STATIC void BIT_addBitsFast(BIT_CStream_t *bitC, size_t value, unsigned nbBits) in BIT_addBitsFast() argument
187 bitC->bitContainer |= value << bitC->bitPos; in BIT_addBitsFast()
188 bitC->bitPos += nbBits; in BIT_addBitsFast()
193 ZSTD_STATIC void BIT_flushBitsFast(BIT_CStream_t *bitC) in BIT_flushBitsFast() argument
195 size_t const nbBytes = bitC->bitPos >> 3; in BIT_flushBitsFast()
196 ZSTD_writeLEST(bitC->ptr, bitC->bitContainer); in BIT_flushBitsFast()
197 bitC->ptr += nbBytes; in BIT_flushBitsFast()
198 bitC->bitPos &= 7; in BIT_flushBitsFast()
199 …bitC->bitContainer >>= nbBytes * 8; /* if bitPos >= sizeof(bitContainer)*8 --> undefined behavior … in BIT_flushBitsFast()
205 ZSTD_STATIC void BIT_flushBits(BIT_CStream_t *bitC) in BIT_flushBits() argument
207 size_t const nbBytes = bitC->bitPos >> 3; in BIT_flushBits()
208 ZSTD_writeLEST(bitC->ptr, bitC->bitContainer); in BIT_flushBits()
209 bitC->ptr += nbBytes; in BIT_flushBits()
210 if (bitC->ptr > bitC->endPtr) in BIT_flushBits()
211 bitC->ptr = bitC->endPtr; in BIT_flushBits()
212 bitC->bitPos &= 7; in BIT_flushBits()
213 …bitC->bitContainer >>= nbBytes * 8; /* if bitPos >= sizeof(bitContainer)*8 --> undefined behavior … in BIT_flushBits()
219 ZSTD_STATIC size_t BIT_closeCStream(BIT_CStream_t *bitC) in BIT_closeCStream() argument
221 BIT_addBitsFast(bitC, 1, 1); /* endMark */ in BIT_closeCStream()
222 BIT_flushBits(bitC); in BIT_closeCStream()
224 if (bitC->ptr >= bitC->endPtr) in BIT_closeCStream()
227 return (bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0); in BIT_closeCStream()