1 // license:BSD-3-Clause
\r
2 // copyright-holders:Aaron Giles
\r
3 /***************************************************************************
\r
7 Helper classes for reading/writing at the bit level.
\r
9 ***************************************************************************/
\r
13 #ifndef __BITSTREAM_H__
\r
14 #define __BITSTREAM_H__
\r
18 //**************************************************************************
\r
20 //**************************************************************************
\r
22 // helper class for reading from a bit buffer
\r
25 uint32_t buffer; // current bit accumulator
\r
26 int bits; // number of bits in the accumulator
\r
27 const uint8_t * read; // read pointer
\r
28 uint32_t doffset; // byte offset within the data
\r
29 uint32_t dlength; // length of the data
\r
32 struct bitstream* create_bitstream(const void *src, uint32_t srclength);
\r
33 int bitstream_overflow(struct bitstream* bitstream);
\r
34 uint32_t bitstream_read_offset(struct bitstream* bitstream);
\r
36 uint32_t bitstream_read(struct bitstream* bitstream, int numbits);
\r
37 uint32_t bitstream_peek(struct bitstream* bitstream, int numbits);
\r
38 void bitstream_remove(struct bitstream* bitstream, int numbits);
\r
39 uint32_t bitstream_flush(struct bitstream* bitstream);
\r