From d77ed9c62baf87a98175e3a4c00d11fdcbd104be Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Tue, 30 Apr 2024 22:24:40 +0100 Subject: [PATCH] update Byte Order compile-time checks previous version failed on macos-14-arm64 --- src/include/stir/ByteOrderDefine.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/include/stir/ByteOrderDefine.h b/src/include/stir/ByteOrderDefine.h index de909de3b..ca18f2d8f 100644 --- a/src/include/stir/ByteOrderDefine.h +++ b/src/include/stir/ByteOrderDefine.h @@ -23,10 +23,14 @@ START_NAMESPACE_STIR // currently checked by asserts() +// partially from https://stackoverflow.com/a/27054190 #if !defined(__alpha) && (!defined(_WIN32) || defined(_M_PPC) || defined(_M_MPPC)) && !defined(__i386__) && !defined(__i486__) \ && !defined(__i586__) && !defined(__i686__) && !defined(__i786__) && !defined(__i886__) && !defined(__k6__) \ && !defined(__athlon__) && !defined(__x86_64__) && !defined(__k6__) \ - || (defined(__MSL__) && !defined(__LITTLE_ENDIAN)) + || (defined(__MSL__) && !defined(__LITTLE_ENDIAN)) || (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN) \ + || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) /* gcc */) || defined(__BIG_ENDIAN__) \ + || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) \ + || defined(__MIBSEB__) # define STIRIsNativeByteOrderBigEndian 1 # define STIRIsNativeByteOrderLittleEndian 0 #else