19 uint8_t m_current = 0;
22 bool m_is_final =
false;
23 uint8_t m_final_bits = 0;
27 inline void read_next() {
28 const uint8_t MSB = 7;
46 if(m_final_bits >= 6) {
56 m_final_bits = m_current & 0x7;
98 uint8_t bit = (m_current >> m_cursor) & 1;
119 inline T
read_int(
size_t amount =
sizeof(T) * CHAR_BIT) {
121 for(
size_t i = 0; i < amount; i++) {
128 template<
typename value_t>
135 template<
typename value_t>
137 size_t mod = read_int<size_t>(2);
144 mod = read_int<size_t>(2);
152 template<
typename value_t>
154 auto bits = read_unary<size_t>();
155 return read_int<value_t>(bits);
158 template<
typename value_t>
160 auto bits = read_elias_gamma<size_t>();
161 return read_int<value_t>(bits);
174 template<
typename T =
size_t>
184 value |= (read_int<size_t>(b) << (b * (i++)));
192 return m_is_final && m_cursor <= (7 - m_final_bits);
T read_compressed_int(size_t b=7)
Reads a compressed integer from the input.
Contains the text compression and encoding framework.
value_t read_elias_delta()
value_t read_elias_gamma()
Wrapper for input streams that provides bitwise reading functionality.
BitIStream(Input &input)
Constructs a bitwise input stream.
BitIStream(InputStream &&input)
Constructs a bitwise input stream.
bool eof() const
TODO document.
uint8_t read_bit()
Reads the next single bit from the input.
T read_int(size_t amount=sizeof(T) *CHAR_BIT)
Reads the integer value of the next amount bits in MSB first order.