16inline std::uint16_t
readLittle16(std::span<const std::uint8_t> bytes, std::size_t offset) {
17 return static_cast<std::uint16_t
>(bytes[offset] | (bytes[offset + 1] << 8));
27inline std::uint32_t
readLittle32(std::span<const std::uint8_t> bytes, std::size_t offset) {
28 return static_cast<std::uint32_t
>(bytes[offset]) |
29 (
static_cast<std::uint32_t
>(bytes[offset + 1]) << 8) |
30 (
static_cast<std::uint32_t
>(bytes[offset + 2]) << 16) |
31 (
static_cast<std::uint32_t
>(bytes[offset + 3]) << 24);
45 std::size_t width = 4) {
46 for (std::size_t i = 0; i < width; ++i) {
47 bytes[offset + i] =
static_cast<std::uint8_t
>(value >> (8 * i));
59inline void writeBig(std::span<std::uint8_t> bytes,
62 std::size_t width = 4) {
63 for (std::size_t i = 0; i < width; ++i) {
64 bytes[offset + i] =
static_cast<std::uint8_t
>(value >> (8 * (width - 1 - i)));
79 std::size_t width = 4) {
81 writeBig(bytes, offset + width, value, width);