From d77287e954f02706502028baadc8c87e7382301b Mon Sep 17 00:00:00 2001 From: ithewei Date: Tue, 29 Nov 2022 10:37:21 +0800 Subject: [PATCH] judge BYTE_ORDER --- base/hplatform.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/base/hplatform.h b/base/hplatform.h index 60023230..5e0a290c 100644 --- a/base/hplatform.h +++ b/base/hplatform.h @@ -237,13 +237,19 @@ // BYTE_ORDER #ifndef BYTE_ORDER -#if defined(ARCH_X86) || defined(ARCH_X86_64) || \ - defined(__ARMEL__) || defined(__AARCH64EL__) || \ - defined(__MIPSEL) || defined(__MIPS64EL) +#if defined(__BYTE_ORDER) + #define BYTE_ORDER __BYTE_ORDER +#elif defined(__BYTE_ORDER__) + #define BYTE_ORDER __BYTE_ORDER__ +#elif defined(ARCH_X86) || defined(ARCH_X86_64) || \ + defined(__ARMEL__) || defined(__AARCH64EL__) || \ + defined(__MIPSEL) || defined(__MIPS64EL) #define BYTE_ORDER LITTLE_ENDIAN #elif defined(__ARMEB__) || defined(__AARCH64EB__) || \ defined(__MIPSEB) || defined(__MIPS64EB) #define BYTE_ORDER BIG_ENDIAN +#elif defined(OS_WIN) + #define BYTE_ORDER LITTLE_ENDIAN #else #warning "Unknown byte order!" #endif