Lines Matching refs:bits
207 static inline void bitstream_cursor_advance(struct bitstream_cursor *cur, unsigned int bits) in bitstream_cursor_advance() argument
209 bits += cur->bit; in bitstream_cursor_advance()
210 cur->b = cur->b + (bits >> 3); in bitstream_cursor_advance()
211 cur->bit = bits & 7; in bitstream_cursor_advance()
248 static inline int bitstream_put_bits(struct bitstream *bs, u64 val, const unsigned int bits) in bitstream_put_bits() argument
253 if (bits == 0) in bitstream_put_bits()
256 if ((bs->cur.b + ((bs->cur.bit + bits -1) >> 3)) - bs->buf >= bs->buf_len) in bitstream_put_bits()
260 if (bits < 64) in bitstream_put_bits()
261 val &= ~0ULL >> (64 - bits); in bitstream_put_bits()
265 for (tmp = 8 - bs->cur.bit; tmp < bits; tmp += 8) in bitstream_put_bits()
268 bitstream_cursor_advance(&bs->cur, bits); in bitstream_put_bits()
269 return bits; in bitstream_put_bits()
281 static inline int bitstream_get_bits(struct bitstream *bs, u64 *out, int bits) in bitstream_get_bits() argument
286 if (bits > 64) in bitstream_get_bits()
289 if (bs->cur.b + ((bs->cur.bit + bs->pad_bits + bits -1) >> 3) - bs->buf >= bs->buf_len) in bitstream_get_bits()
290 bits = ((bs->buf_len - (bs->cur.b - bs->buf)) << 3) in bitstream_get_bits()
293 if (bits == 0) { in bitstream_get_bits()
300 n = (bs->cur.bit + bits + 7) >> 3; in bitstream_get_bits()
312 val &= ~0ULL >> (64 - bits); in bitstream_get_bits()
314 bitstream_cursor_advance(&bs->cur, bits); in bitstream_get_bits()
317 return bits; in bitstream_get_bits()
331 int bits = __vli_encode_bits(&code, in); in vli_encode_bits() local
333 if (bits <= 0) in vli_encode_bits()
334 return bits; in vli_encode_bits()
336 return bitstream_put_bits(bs, code, bits); in vli_encode_bits()