Lines Matching refs:bitC

48 ZSTD_STATIC size_t BIT_initCStream(BIT_CStream_t *bitC, void *dstBuffer, size_t dstCapacity);
49 ZSTD_STATIC void BIT_addBits(BIT_CStream_t *bitC, size_t value, unsigned nbBits);
50 ZSTD_STATIC void BIT_flushBits(BIT_CStream_t *bitC);
51 ZSTD_STATIC size_t BIT_closeCStream(BIT_CStream_t *bitC);
106 ZSTD_STATIC void BIT_addBitsFast(BIT_CStream_t *bitC, size_t value, unsigned nbBits);
109 ZSTD_STATIC void BIT_flushBitsFast(BIT_CStream_t *bitC);
132 ZSTD_STATIC size_t BIT_initCStream(BIT_CStream_t *bitC, void *startPtr, size_t dstCapacity) in BIT_initCStream() argument
134 bitC->bitContainer = 0; in BIT_initCStream()
135 bitC->bitPos = 0; in BIT_initCStream()
136 bitC->startPtr = (char *)startPtr; in BIT_initCStream()
137 bitC->ptr = bitC->startPtr; in BIT_initCStream()
138 bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->ptr); in BIT_initCStream()
139 if (dstCapacity <= sizeof(bitC->ptr)) in BIT_initCStream()
147 ZSTD_STATIC void BIT_addBits(BIT_CStream_t *bitC, size_t value, unsigned nbBits) in BIT_addBits() argument
149 bitC->bitContainer |= (value & BIT_mask[nbBits]) << bitC->bitPos; in BIT_addBits()
150 bitC->bitPos += nbBits; in BIT_addBits()
155 ZSTD_STATIC void BIT_addBitsFast(BIT_CStream_t *bitC, size_t value, unsigned nbBits) in BIT_addBitsFast() argument
157 bitC->bitContainer |= value << bitC->bitPos; in BIT_addBitsFast()
158 bitC->bitPos += nbBits; in BIT_addBitsFast()
163 ZSTD_STATIC void BIT_flushBitsFast(BIT_CStream_t *bitC) in BIT_flushBitsFast() argument
165 size_t const nbBytes = bitC->bitPos >> 3; in BIT_flushBitsFast()
166 ZSTD_writeLEST(bitC->ptr, bitC->bitContainer); in BIT_flushBitsFast()
167 bitC->ptr += nbBytes; in BIT_flushBitsFast()
168 bitC->bitPos &= 7; in BIT_flushBitsFast()
169bitC->bitContainer >>= nbBytes * 8; /* if bitPos >= sizeof(bitContainer)*8 --> undefined behavior … in BIT_flushBitsFast()
175 ZSTD_STATIC void BIT_flushBits(BIT_CStream_t *bitC) in BIT_flushBits() argument
177 size_t const nbBytes = bitC->bitPos >> 3; in BIT_flushBits()
178 ZSTD_writeLEST(bitC->ptr, bitC->bitContainer); in BIT_flushBits()
179 bitC->ptr += nbBytes; in BIT_flushBits()
180 if (bitC->ptr > bitC->endPtr) in BIT_flushBits()
181 bitC->ptr = bitC->endPtr; in BIT_flushBits()
182 bitC->bitPos &= 7; in BIT_flushBits()
183bitC->bitContainer >>= nbBytes * 8; /* if bitPos >= sizeof(bitContainer)*8 --> undefined behavior … in BIT_flushBits()
189 ZSTD_STATIC size_t BIT_closeCStream(BIT_CStream_t *bitC) in BIT_closeCStream() argument
191 BIT_addBitsFast(bitC, 1, 1); /* endMark */ in BIT_closeCStream()
192 BIT_flushBits(bitC); in BIT_closeCStream()
194 if (bitC->ptr >= bitC->endPtr) in BIT_closeCStream()
197 return (bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0); in BIT_closeCStream()