Lines Matching refs:cur
199 static inline void bitstream_cursor_reset(struct bitstream_cursor *cur, void *s) in bitstream_cursor_reset() argument
201 cur->b = s; in bitstream_cursor_reset()
202 cur->bit = 0; in bitstream_cursor_reset()
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()
216 struct bitstream_cursor cur; member
231 bitstream_cursor_reset(&bs->cur, bs->buf); in bitstream_init()
236 bitstream_cursor_reset(&bs->cur, bs->buf); in bitstream_rewind()
250 unsigned char *b = bs->cur.b; in bitstream_put_bits()
256 if ((bs->cur.b + ((bs->cur.bit + bits -1) >> 3)) - bs->buf >= bs->buf_len) in bitstream_put_bits()
263 *b++ |= (val & 0xff) << bs->cur.bit; 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()
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()
291 - bs->cur.bit - bs->pad_bits; in bitstream_get_bits()
300 n = (bs->cur.bit + bits + 7) >> 3; in bitstream_get_bits()
304 memcpy(&val, bs->cur.b+1, n - 1); in bitstream_get_bits()
305 val = le64_to_cpu(val) << (8 - bs->cur.bit); in bitstream_get_bits()
309 val |= bs->cur.b[0] >> bs->cur.bit; in bitstream_get_bits()
314 bitstream_cursor_advance(&bs->cur, bits); in bitstream_get_bits()