11template <
typename _Tp>
12 requires std::integral<_Tp>
14 if constexpr (std::endian::native == std::endian::little) {
15 return std::byteswap(tp);
22template <
typename _Tp>
23 requires std::is_trivially_copyable_v<_Tp>
26 std::memcpy(&tp, src,
sizeof(_Tp));
constexpr _Tp read_from_bytes(const uint8_t *src)
Read a trivially copyable type from a byte array.
Definition utils.hxx:24
constexpr _Tp autoswap(_Tp tp)
Byte-swap a value if the host is little-endian.
Definition utils.hxx:13