From f5a3a443af9fda85d7963197cbd35d182139379d Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Sat, 8 Feb 2025 14:38:18 +0100 Subject: [PATCH] optimise endian --- include/sp/common/ByteSwapping.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/sp/common/ByteSwapping.h b/include/sp/common/ByteSwapping.h index 55d2fdc..5eb2e5a 100644 --- a/include/sp/common/ByteSwapping.h +++ b/include/sp/common/ByteSwapping.h @@ -17,9 +17,9 @@ void SwapBytes(T& value) { } bool IsSystemBigEndian() { - std::uint16_t test = 0; - reinterpret_cast(&test)[1] = 1; - return test == 1; + static constexpr std::uint16_t test = 10; + static const bool isBigEndian = reinterpret_cast(&test)[1] == 10; + return isBigEndian; } /**