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