32 inline void write_next() {
34 m_stream.put(
char(m_next));
54 char set = 7 - m_cursor;
74 return m_stream.
tellp();
81 m_next |= (1 << m_cursor);
98 inline void write_int(T value,
size_t bits =
sizeof(T) * CHAR_BIT) {
99 for (
int i = bits - 1; i >= 0; i--) {
100 write_bit((value & T(T(1) << i)) != T(0));
104 template<
typename value_t>
113 template<
typename value_t>
125 template<
typename value_t>
131 template<
typename value_t>
154 uint64_t u = uint64_t(v);
155 uint64_t mask = (u << b) - 1;
157 uint64_t current = v & mask;
auto tellp() -> decltype(m_stream.tellp())
Returns the output position indicator of the underlying stream, which should equal the amount of byte...
Contains the text compression and encoding framework.
void write_ternary(value_t v)
constexpr uint_fast8_t bits_for(size_t n)
Computes the number of bits required to store the given integer value.
Provides a character stream to the underlying output.
void write_bit(bool set)
Writes a single bit to the output.
void write_elias_gamma(value_t v)
void write_unary(value_t v)
BitOStream(OutputStream &&output)
Constructs a bitwise output stream.
Wrapper for output streams that provides bitwise writing functionality.
An abstraction layer for algorithm output.
void write_compressed_int(T v, size_t b=7)
Writes a compressed integer to the input.
void write_elias_delta(value_t v)
void write_int(T value, size_t bits=sizeof(T) *CHAR_BIT)
Writes the bit representation of an integer in MSB first order to the output.
BitOStream(Output &output)
Constructs a bitwise output stream.