diff options
Diffstat (limited to 'src/lib/util/bitstream.h')
-rw-r--r-- | src/lib/util/bitstream.h | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/lib/util/bitstream.h b/src/lib/util/bitstream.h index 2f36271d296..0056c4ce38e 100644 --- a/src/lib/util/bitstream.h +++ b/src/lib/util/bitstream.h @@ -25,25 +25,25 @@ class bitstream_in { public: // construction/destruction - bitstream_in(const void *src, UINT32 srclength); + bitstream_in(const void *src, uint32_t srclength); // getters bool overflow() const { return ((m_doffset - m_bits / 8) > m_dlength); } - UINT32 read_offset() const; + uint32_t read_offset() const; // operations - UINT32 read(int numbits); - UINT32 peek(int numbits); + uint32_t read(int numbits); + uint32_t peek(int numbits); void remove(int numbits); - UINT32 flush(); + uint32_t flush(); private: // internal state - UINT32 m_buffer; // current bit accumulator + uint32_t m_buffer; // current bit accumulator int m_bits; // number of bits in the accumulator - const UINT8 * m_read; // read pointer - UINT32 m_doffset; // byte offset within the data - UINT32 m_dlength; // length of the data + const uint8_t * m_read; // read pointer + uint32_t m_doffset; // byte offset within the data + uint32_t m_dlength; // length of the data }; @@ -52,22 +52,22 @@ class bitstream_out { public: // construction/destruction - bitstream_out(void *dest, UINT32 destlength); + bitstream_out(void *dest, uint32_t destlength); // getters bool overflow() const { return (m_doffset > m_dlength); } // operations - void write(UINT32 newbits, int numbits); - UINT32 flush(); + void write(uint32_t newbits, int numbits); + uint32_t flush(); private: // internal state - UINT32 m_buffer; // current bit accumulator + uint32_t m_buffer; // current bit accumulator int m_bits; // number of bits in the accumulator - UINT8 * m_write; // write pointer - UINT32 m_doffset; // byte offset within the data - UINT32 m_dlength; // length of the data + uint8_t * m_write; // write pointer + uint32_t m_doffset; // byte offset within the data + uint32_t m_dlength; // length of the data }; @@ -80,10 +80,10 @@ private: // bitstream_in - constructor //------------------------------------------------- -inline bitstream_in::bitstream_in(const void *src, UINT32 srclength) +inline bitstream_in::bitstream_in(const void *src, uint32_t srclength) : m_buffer(0), m_bits(0), - m_read(reinterpret_cast<const UINT8 *>(src)), + m_read(reinterpret_cast<const uint8_t *>(src)), m_doffset(0), m_dlength(srclength) { @@ -95,7 +95,7 @@ inline bitstream_in::bitstream_in(const void *src, UINT32 srclength) // but don't advance the input pointer //------------------------------------------------- -inline UINT32 bitstream_in::peek(int numbits) +inline uint32_t bitstream_in::peek(int numbits) { if (numbits == 0) return 0; @@ -133,9 +133,9 @@ inline void bitstream_in::remove(int numbits) // read - fetch the requested number of bits //------------------------------------------------- -inline UINT32 bitstream_in::read(int numbits) +inline uint32_t bitstream_in::read(int numbits) { - UINT32 result = peek(numbits); + uint32_t result = peek(numbits); remove(numbits); return result; } @@ -145,9 +145,9 @@ inline UINT32 bitstream_in::read(int numbits) // read_offset - return the current read offset //------------------------------------------------- -inline UINT32 bitstream_in::read_offset() const +inline uint32_t bitstream_in::read_offset() const { - UINT32 result = m_doffset; + uint32_t result = m_doffset; int bits = m_bits; while (bits >= 8) { @@ -162,7 +162,7 @@ inline UINT32 bitstream_in::read_offset() const // flush - flush to the nearest byte //------------------------------------------------- -inline UINT32 bitstream_in::flush() +inline uint32_t bitstream_in::flush() { while (m_bits >= 8) { @@ -178,10 +178,10 @@ inline UINT32 bitstream_in::flush() // bitstream_out - constructor //------------------------------------------------- -inline bitstream_out::bitstream_out(void *dest, UINT32 destlength) +inline bitstream_out::bitstream_out(void *dest, uint32_t destlength) : m_buffer(0), m_bits(0), - m_write(reinterpret_cast<UINT8 *>(dest)), + m_write(reinterpret_cast<uint8_t *>(dest)), m_doffset(0), m_dlength(destlength) { @@ -194,7 +194,7 @@ inline bitstream_out::bitstream_out(void *dest, UINT32 destlength) // data stream //------------------------------------------------- -inline void bitstream_out::write(UINT32 newbits, int numbits) +inline void bitstream_out::write(uint32_t newbits, int numbits) { // flush the buffer if we're going to overflow it if (m_bits + numbits > 32) @@ -224,7 +224,7 @@ inline void bitstream_out::write(UINT32 newbits, int numbits) // final output size in bytes //------------------------------------------------- -inline UINT32 bitstream_out::flush() +inline uint32_t bitstream_out::flush() { while (m_bits > 0) { |