Class PackedBitWriter

Class Documentation

class PackedBitWriter

a growing sequence of bits, packed in bytes, the first bit in the most significant bit of the first byte

Public Functions

void put(bool b)

appends the bit b

void put(std::uint64_t v, int k)

appends the k low bits of v, the most significant first

Pre:

0 <= k <= 64, v < 2^k

void put(const std::string &s)

appends the bits of s, a string of ‘0’ and ‘1’

Pre:

s has only ‘0’ and ‘1’

inline std::size_t size(void) const

the number of bits written

inline const std::vector<std::uint8_t> &bytes(void) const

the bytes, the last one padded with zeros