There is no need to have architecture-specific logic to determine the bitness and the endianness of the architecture: built-in compiler defines can give us this information easily. Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com> --- webrtc/typedefs.h | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h index d875490..fa16b31 100644 --- a/webrtc/typedefs.h +++ b/webrtc/typedefs.h @@ -21,34 +21,21 @@ #if defined(_M_X64) || defined(__x86_64__) #define WEBRTC_ARCH_X86_FAMILY #define WEBRTC_ARCH_X86_64 -#define WEBRTC_ARCH_64_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(__aarch64__) -#define WEBRTC_ARCH_64_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN #elif defined(_M_IX86) || defined(__i386__) #define WEBRTC_ARCH_X86_FAMILY #define WEBRTC_ARCH_X86 +#endif + +#if __SIZEOF_LONG__ == 8 +#define WEBRTC_ARCH_64_BITS +#else #define WEBRTC_ARCH_32_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(__ARMEL__) -// TODO(ajm): We'd prefer to control platform defines here, but this is -// currently provided by the Android makefiles. Commented to avoid duplicate -// definition warnings. -//#define WEBRTC_ARCH_ARM -// TODO(ajm): Chromium uses the following two defines. Should we switch? -//#define WEBRTC_ARCH_ARM_FAMILY -//#define WEBRTC_ARCH_ARMEL -#define WEBRTC_ARCH_32_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(__MIPSEL__) -#define WEBRTC_ARCH_32_BITS -#define WEBRTC_ARCH_LITTLE_ENDIAN -#elif defined(__pnacl__) -#define WEBRTC_ARCH_32_BITS +#endif + +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define WEBRTC_ARCH_LITTLE_ENDIAN #else -#error Please add support for your architecture in typedefs.h +#define WEBRTC_ARCH_BIG_ENDIAN #endif #if !(defined(WEBRTC_ARCH_LITTLE_ENDIAN) ^ defined(WEBRTC_ARCH_BIG_ENDIAN)) -- 2.7.4