39#ifndef __ADS_PackedBits
40 #define __ADS_PackedBits
79 void put( std::uint64_t v ,
int k );
84 void put(
const std::string & s );
87 [[nodiscard]] std::size_t
size(
void )
const {
return( f_size ); }
90 [[nodiscard]]
const std::vector< std::uint8_t > &
bytes(
void )
const {
96 std::vector< std::uint8_t > f_bytes;
97 std::size_t f_size = 0;
121 std::uint64_t
get(
int k );
124 [[nodiscard]] std::size_t
position(
void )
const {
return( f_pos ); }
127 [[nodiscard]] std::size_t
size(
void )
const {
128 return( 8 * f_bytes.size() );
133 std::span< const std::uint8_t > f_bytes;
134 std::size_t f_pos = 0;
146#include "ADS/compression/impl/PackedBits.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
PackedBitReader(std::span< const std::uint8_t > b)
the reader of the bytes , which must outlive it
Definition PackedBits.h:113
std::uint64_t get(int k)
the value of the next bits, the first the most significant
std::size_t position(void) const
the number of bits read, past the end too
Definition PackedBits.h:124
bool get(void)
the next bit, 0 past the end
std::size_t size(void) const
the number of bits of the bytes
Definition PackedBits.h:127
a growing sequence of bits, packed in bytes, the first bit in the most significant bit of the first b...
Definition PackedBits.h:70
void put(bool b)
appends the bit
std::size_t size(void) const
the number of bits written
Definition PackedBits.h:87
const std::vector< std::uint8_t > & bytes(void) const
the bytes, the last one padded with zeros
Definition PackedBits.h:90
void put(std::uint64_t v, int k)
appends the low bits of , the most significant first
void put(const std::string &s)
appends the bits of , a string of '0' and '1'