From f31da0fb0dc2dd1b0ac771cb6c51b1cbd43c4821 Mon Sep 17 00:00:00 2001 From: Alexander Sokolov Date: Sat, 1 Jun 2024 12:23:35 +0300 Subject: [PATCH] Use __BYTE_ORDER__ for define TARGET_RT_LITTLE_ENDIAN --- vendor/alac/codec/EndianPortable.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/vendor/alac/codec/EndianPortable.c b/vendor/alac/codec/EndianPortable.c index 284cf62..da9423d 100644 --- a/vendor/alac/codec/EndianPortable.c +++ b/vendor/alac/codec/EndianPortable.c @@ -29,24 +29,18 @@ // ***************************************** // Defining the bit order for different architectures -#if defined(__i386__) -#define TARGET_RT_LITTLE_ENDIAN 1 -#elif defined(__x86_64__) -#define TARGET_RT_LITTLE_ENDIAN 1 -#elif defined(__arm64__) -#define TARGET_RT_LITTLE_ENDIAN 1 -#elif defined(__aarch64__) -#define TARGET_RT_LITTLE_ENDIAN 1 -#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -#define TARGET_RT_LITTLE_ENDIAN 1 -#elif defined (TARGET_OS_WIN32) -#define TARGET_RT_LITTLE_ENDIAN 1 -#else -#define TARGET_RT_LITTLE_ENDIAN 0 +#include + +#if defined(__linux__) || defined(__unix__) +#include #endif -#ifndef TARGET_RT_LITTLE_ENDIAN -#error TARGET_RT_LITTLE_ENDIAN not defined! +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define TARGET_RT_LITTLE_ENDIAN 1 +#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define TARGET_RT_LITTLE_ENDIAN 0 +#else +#error Cannot determine endianness! #endif // *****************************************