[ox/std] Add toLittleEndian and toBigEndian functions

This commit is contained in:
Gary Talent 2022-08-07 10:22:45 -05:00
parent c0081619e6
commit 28960dd680

View File

@ -63,6 +63,16 @@ constexpr T conditionalByteSwap(T i) noexcept {
} }
} }
template<typename T>
constexpr T toLittleEndian(T i) noexcept {
return conditionalByteSwap<T, defines::BigEndian>(i);
}
template<typename T>
constexpr T toBigEndian(T i) noexcept {
return conditionalByteSwap<T, defines::BigEndian>(i);
}
template<typename T, bool byteSwap> template<typename T, bool byteSwap>
class OX_PACKED ByteSwapInteger { class OX_PACKED ByteSwapInteger {
private: private: