7#include "exception.hpp"
12namespace hi::inline v1 {
20[[nodiscard]]
inline bool get_bit(std::span<std::byte const> buffer,
std::size_t &index)
noexcept
22 auto byte_index = index >> 3;
23 auto bit_index = index & 7;
26 hi_axiom(byte_index < buffer.size());
27 return static_cast<bool>(
static_cast<uint8_t
>(buffer[byte_index] >> bit_index) & 1);
57 auto byte_index = index >> 3;
58 auto bit_index = index & 7;
59 hi_axiom(byte_index < buffer.size());
61 auto available_bits = 8 - bit_index;
62 auto nr_bits =
std::min(available_bits, todo);
64 auto mask = (1 << nr_bits) - 1;
66 auto tmp =
static_cast<int>(buffer[byte_index] >> bit_index) & mask;