22 lines
443 B
C++
22 lines
443 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
namespace bitstream
|
|
{
|
|
/**
|
|
* @brief A byte buffer aligned to 4 bytes.
|
|
* Can be used with bit_reader and bit_writer.
|
|
* @note Size must be a multiple of 4
|
|
*/
|
|
template<size_t Size>
|
|
struct byte_buffer
|
|
{
|
|
static_assert(Size % 4 == 0, "Buffer size must be a multiple of 4");
|
|
|
|
alignas(uint32_t) uint8_t Bytes[Size];
|
|
|
|
uint8_t& operator[](size_t i) noexcept { return Bytes[i]; }
|
|
};
|
|
} |