Lines Matching refs:cur
199 static inline void bitstream_cursor_reset(struct bitstream_cursor *cur, void *s)
201 cur->b = s;
202 cur->bit = 0;
207 static inline void bitstream_cursor_advance(struct bitstream_cursor *cur, unsigned int bits)
209 bits += cur->bit;
210 cur->b = cur->b + (bits >> 3);
211 cur->bit = bits & 7;
216 struct bitstream_cursor cur;
231 bitstream_cursor_reset(&bs->cur, bs->buf);
236 bitstream_cursor_reset(&bs->cur, bs->buf);
250 unsigned char *b = bs->cur.b;
256 if ((bs->cur.b + ((bs->cur.bit + bits -1) >> 3)) - bs->buf >= bs->buf_len)
263 *b++ |= (val & 0xff) << bs->cur.bit;
265 for (tmp = 8 - bs->cur.bit; tmp < bits; tmp += 8)
268 bitstream_cursor_advance(&bs->cur, bits);
289 if (bs->cur.b + ((bs->cur.bit + bs->pad_bits + bits -1) >> 3) - bs->buf >= bs->buf_len)
290 bits = ((bs->buf_len - (bs->cur.b - bs->buf)) << 3)
291 - bs->cur.bit - bs->pad_bits;
300 n = (bs->cur.bit + bits + 7) >> 3;
301 /* n may be at most 9, if cur.bit + bits > 64 */
304 memcpy(&val, bs->cur.b+1, n - 1);
305 val = le64_to_cpu(val) << (8 - bs->cur.bit);
309 val |= bs->cur.b[0] >> bs->cur.bit;
314 bitstream_cursor_advance(&bs->cur, bits);