29 #include <boost/cstdint.hpp>
41 typedef unsigned char byte;
66 usedBits(from.usedBits)
78 void setBuffer(
byte* input,
size_t len)
89 unsigned read_uint(
unsigned short bitcount);
100 boost::int32_t read_sint(
unsigned short bitcount);
103 boost::uint8_t read_u8()
110 boost::int8_t read_s8()
112 return static_cast<boost::int8_t
>(read_u8());
116 boost::uint16_t read_u16()
120 boost::uint16_t result = *ptr++;
121 result |= *ptr++ << 8;
126 boost::int16_t read_s16()
128 return static_cast<boost::int16_t
>(read_u16());
132 boost::uint32_t read_u32()
136 boost::uint32_t result = *ptr++;
137 result |= *ptr++ << 8;
138 result |= *ptr++ << 16;
139 result |= *ptr++ << 24;
144 boost::int32_t read_s32()
146 return static_cast<boost::int32_t
>(read_u32());
154 if ( usedBits ) advanceToNextByte();
158 bool gotBits(boost::uint32_t nbits)
160 boost::uint32_t gotbits = 8-usedBits +8*(
end-ptr-1);
161 if (gotbits > nbits)
return true;
167 void advanceToNextByte()
171 log_debug(
_(
"Going round"));
195 #endif // BITSREADER_H