Class BitWriter

Class Documentation

class BitWriter

a stream of bits written at its end, on a BitVector

Public Functions

BitWriter(void) = default
std::size_t size(void) const

the bits written so far

void writeBit(bool b)
void write(Word v, int len)

the len bits of v, the least significant first

Pre:

len <= 64 and v < 2^len

void writeBinary(Word v, int len)

the len bits of v, the most significant first

Pre:

len <= 64 and v < 2^len

void writeUnary(std::uint64_t q)

q zeros and a 1

const BitVector &bits(void) const

the bits written

BitVector release(void)

the bits written, which the writer leaves empty