Pixie
Loading...
Searching...
No Matches
pixie::PackedBitBuilder Class Reference

Builder for a packed LSB-first bit sequence. More...

#include <packed_bit_builder.h>

Public Member Functions

void write_bit (bool bit)
 Append one bit.
 
void write_bits (std::uint64_t bits, std::size_t width)
 Append the low width bits of bits, least-significant bit first.
 
std::size_t size_bits () const noexcept
 Return the number of appended bits.
 
void reserve_bits (std::size_t size_bits)
 Reserve storage for at least size_bits bits.
 
std::vector< std::uint64_t > take_words ()
 Transfer the packed words and reset this builder.
 

Detailed Description

Builder for a packed LSB-first bit sequence.

This type is intended for constructing succinct bit vectors, not for persistent serialization. take_words() transfers the packed words and resets the builder to an empty, reusable state.

Member Function Documentation

◆ write_bits()

void pixie::PackedBitBuilder::write_bits ( std::uint64_t bits,
std::size_t width )
inline

Append the low width bits of bits, least-significant bit first.

Exceptions
std::invalid_argumentif width is greater than 64.
std::length_errorif the resulting bit count is not representable.

The documentation for this class was generated from the following file: