RPNX::Compress
Self-contained C++20 compression and ZIP library
 
Loading...
Searching...
No Matches
rpnx::compression::zstandard_codec::forward_bit_reader Class Reference

Read a byte-aligned, forward, least-significant-bit-first bitstream. More...

#include <zstandard.hpp>

Public Member Functions

 forward_bit_reader (std::span< std::byte const > input) noexcept
 Constructs a reader over a non-owning byte span.
 
std::uint32_t peek_bits (std::uint8_t count) const
 Returns the next bits without consuming them.
 
std::uint32_t read_bits (std::uint8_t count)
 Consumes and returns the next bits.
 
std::size_t consumed_bytes () const noexcept
 Returns the whole number of bytes occupied by consumed bits.
 

Detailed Description

Read a byte-aligned, forward, least-significant-bit-first bitstream.

Definition at line 137 of file zstandard.hpp.

Constructor & Destructor Documentation

◆ forward_bit_reader()

rpnx::compression::zstandard_codec::forward_bit_reader::forward_bit_reader ( std::span< std::byte const > input)
inlineexplicitnoexcept

Constructs a reader over a non-owning byte span.

Parameters
inputComplete forward bitstream retained for this object's lifetime.

Definition at line 144 of file zstandard.hpp.

Member Function Documentation

◆ consumed_bytes()

std::size_t rpnx::compression::zstandard_codec::forward_bit_reader::consumed_bytes ( ) const
inlinenodiscardnoexcept

Returns the whole number of bytes occupied by consumed bits.

Returns
Consumed bit count rounded up to bytes.

Definition at line 185 of file zstandard.hpp.

Referenced by rpnx::compression::zstandard_codec::parse_normalized_probabilities().

◆ peek_bits()

std::uint32_t rpnx::compression::zstandard_codec::forward_bit_reader::peek_bits ( std::uint8_t count) const
inlinenodiscard

Returns the next bits without consuming them.

Parameters
countNumber of bits, at most 32.
Returns
Field value with the earliest bit in the least significant position.

Definition at line 153 of file zstandard.hpp.

References rpnx::compression::invalid_data, and rpnx::compression::zstandard.

Referenced by rpnx::compression::zstandard_codec::parse_normalized_probabilities(), and read_bits().

◆ read_bits()

std::uint32_t rpnx::compression::zstandard_codec::forward_bit_reader::read_bits ( std::uint8_t count)
inlinenodiscard

Consumes and returns the next bits.

Parameters
countNumber of bits, at most 32.
Returns
Field value with the earliest bit in the least significant position.

Definition at line 174 of file zstandard.hpp.

References peek_bits().

Referenced by rpnx::compression::zstandard_codec::parse_normalized_probabilities().


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