7#include "utility/module.hpp"
11namespace hi::inline
v1 {
21 hilet byte_index = index >> 3;
22 hilet bit_index = index & 7;
25 hi_axiom(byte_index < buffer.size());
26 return to_bool(std::bit_cast<uint8_t>(buffer[byte_index] >> bit_index) & 1);
56 hilet byte_index = index >> 3;
57 hilet bit_index = index & 7;
58 hi_axiom(byte_index < buffer.size());
60 hilet available_bits = 8 - bit_index;
63 hilet mask = (1 << nr_bits) - 1;
65 hilet tmp =
static_cast<int>(buffer[byte_index] >> bit_index) & mask;
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:238
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:13
bool get_bit(std::span< std::byte const > buffer, std::size_t &index) noexcept
Read a single bit from span of bytes Bits are ordered LSB first.
Definition bits.hpp:19
std::size_t get_bits(std::span< std::byte const > buffer, std::size_t &index, std::size_t length) noexcept
Read a bits from of span of bytes Bits are ordered LSB first.
Definition bits.hpp:47