From 28960dd680581b1a3413bcbaec00c3095542e586 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 7 Aug 2022 10:22:45 -0500 Subject: [PATCH] [ox/std] Add toLittleEndian and toBigEndian functions --- deps/ox/src/ox/std/byteswap.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/deps/ox/src/ox/std/byteswap.hpp b/deps/ox/src/ox/std/byteswap.hpp index ab2d05d3..494d00a6 100644 --- a/deps/ox/src/ox/std/byteswap.hpp +++ b/deps/ox/src/ox/std/byteswap.hpp @@ -63,6 +63,16 @@ constexpr T conditionalByteSwap(T i) noexcept { } } +template +constexpr T toLittleEndian(T i) noexcept { + return conditionalByteSwap(i); +} + +template +constexpr T toBigEndian(T i) noexcept { + return conditionalByteSwap(i); +} + template class OX_PACKED ByteSwapInteger { private: