From 4bc13f2678dd6a41cf00f0fd4f4e798f6ce9ed51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Neusch=C3=A4fer?= Date: Mon, 27 Jan 2025 19:37:42 +0100 Subject: [PATCH] Platform.h: Reject big-endian systems (#23684) Several tests fail on big-endian, indicating that the code isn't prepared for such systems, but it wouldn't be obvious from just compiling OpenRCT2. Make it obvious by checking it on Platform.h. Example output: /home/user/src/OpenRCT2/src/openrct2-ui/../openrct2/platform/Platform.h:34:35: error: static assertion failed: OpenRCT2 is known to be broken on big endian. Proceed with caution! 34 | static_assert(std::endian::native == std::endian::little, | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ ninja: job failed --- src/openrct2/platform/Platform.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/openrct2/platform/Platform.h b/src/openrct2/platform/Platform.h index 25f2e6c734..1dbf09e2f0 100644 --- a/src/openrct2/platform/Platform.h +++ b/src/openrct2/platform/Platform.h @@ -13,6 +13,7 @@ #include "../core/DateTime.h" #include "../core/StringTypes.h" +#include #include #include @@ -31,6 +32,9 @@ #define MAX_PATH 260 #endif +static_assert( + std::endian::native == std::endian::little, "OpenRCT2 is known to be broken on big endian. Proceed with caution!"); + enum class SPECIAL_FOLDER { USER_CACHE,