13 std::array<std::byte, 64> data;
25 std::vector<CacheLine> data_;
28 AlignedStorage() =
default;
38 void resize(
size_t bits) { data_.resize((bits + 511) / 512); }
40 std::span<CacheLine>
AsLines() {
return data_; }
48 return std::span<uint64_t>(
reinterpret_cast<uint64_t*
>(data_.data()),
54 return std::span<const uint64_t>(
55 reinterpret_cast<const uint64_t*
>(data_.data()), data_.size() * 8);
63 return std::span<std::byte>(
reinterpret_cast<std::byte*
>(data_.data()),
69 return std::span<const std::byte>(
70 reinterpret_cast<const std::byte*
>(data_.data()), data_.size() * 64);
78 return std::span<std::uint16_t>(
79 reinterpret_cast<std::uint16_t*
>(data_.data()), data_.size() * 32);
84 return std::span<const std::uint16_t>(
85 reinterpret_cast<const std::uint16_t*
>(data_.data()),
std::span< const std::uint16_t > AsConst16BitInts() const
Const view as bytes.
Definition cache_line.h:83
void resize(size_t bits)
Resize storage to hold at least bits bits, rounded up to 512.
Definition cache_line.h:38
std::span< const std::byte > AsConstBytes() const
Const view as bytes.
Definition cache_line.h:68
std::span< const uint64_t > AsConst64BitInts() const
Const view as 64-bit words.
Definition cache_line.h:53
std::span< std::uint16_t > As16BitInts()
Mutable view as bytes.
Definition cache_line.h:77
std::span< CacheLine > AsLines()
Mutable view as cache lines.
Definition cache_line.h:40
AlignedStorage(size_t bits)
Construct storage for at least bits bytes, rounded up to 512 bits.
Definition cache_line.h:33
std::span< std::byte > AsBytes()
Mutable view as bytes.
Definition cache_line.h:62
std::span< const CacheLine > AsConstLines() const
Const view as cache lines.
Definition cache_line.h:42
std::span< uint64_t > As64BitInts()
Mutable view as 64-bit words.
Definition cache_line.h:47
A simple struct to represent a aligned storage for a cache line.
Definition cache_line.h:12