Improve endianness check
Update the `hsa.h` header to use the gcc / clang `__BYTE_ORDER__` macros where available to more accurately autodetect endianness for the target. Change-Id: I7312f3badcba9287a30eb14882b91e2a247acc5f
This commit is contained in:
committed by
David Yat Sin
orang tua
6f828d8609
melakukan
4971150576
@@ -79,8 +79,12 @@
|
||||
|
||||
// Try to detect CPU endianness
|
||||
#if !defined(LITTLEENDIAN_CPU) && !defined(BIGENDIAN_CPU)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || \
|
||||
defined(_M_X64) || defined(__loongarch64) || defined(__riscv)
|
||||
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||
#define LITTLEENDIAN_CPU
|
||||
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
#define BIGENDIAN_CPU
|
||||
#elif defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || \
|
||||
defined(_M_X64) || defined(__loongarch64) || defined(__riscv)
|
||||
#define LITTLEENDIAN_CPU
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user