optimise endian

This commit is contained in:
2025-02-08 14:38:18 +01:00
parent 06d69fb976
commit f5a3a443af

View File

@@ -17,9 +17,9 @@ void SwapBytes(T& value) {
} }
bool IsSystemBigEndian() { bool IsSystemBigEndian() {
std::uint16_t test = 0; static constexpr std::uint16_t test = 10;
reinterpret_cast<std::uint8_t*>(&test)[1] = 1; static const bool isBigEndian = reinterpret_cast<const std::uint8_t*>(&test)[1] == 10;
return test == 1; return isBigEndian;
} }
/** /**