binary_io::endian namespace

Functions

template<std::endian E, class T>
auto load(std::span<const std::byte, sizeof(T)> a_src) -> T noexcept
Loads the given type from the given buffer, with the given endian format, into the native endian format.
template<class T>
auto reverse(T a_value) -> T noexcept
Reverses the endian format of a given input.
template<std::endian E, class T>
void store(std::span<std::byte, sizeof(T)> a_dst, T a_value) noexcept
Stores the given type into the given buffer, from the native endian format into the given endian format.

Function documentation

template<std::endian E, class T>
T binary_io::endian::load(std::span<const std::byte, sizeof(T)> a_src) noexcept

Loads the given type from the given buffer, with the given endian format, into the native endian format.

Parameters
a_src The buffer to load from.
Returns The value loaded from the given buffer.

template<class T>
T binary_io::endian::reverse(T a_value) noexcept

Reverses the endian format of a given input.

Parameters
a_value The value to reverse.
Returns The reversed value.

template<std::endian E, class T>
void binary_io::endian::store(std::span<std::byte, sizeof(T)> a_dst, T a_value) noexcept

Stores the given type into the given buffer, from the native endian format into the given endian format.

Parameters
a_dst The buffer to store into.
a_value The value to be stored.