Blob Blame History Raw
Index: codec/EndianPortable.c
===================================================================
--- codec/EndianPortable.c.orig
+++ codec/EndianPortable.c
@@ -25,20 +25,15 @@
 //
 
 #include <stdio.h>
+#include <byteswap.h>
+#include <endian.h>
 #include "EndianPortable.h"
 
-#define BSWAP16(x) (((x << 8) | ((x >> 8) & 0x00ff)))
-#define BSWAP32(x) (((x << 24) | ((x << 8) & 0x00ff0000) | ((x >> 8) & 0x0000ff00) | ((x >> 24) & 0x000000ff)))
-#define BSWAP64(x) ((((int64_t)x << 56) | (((int64_t)x << 40) & 0x00ff000000000000LL) | \
-                    (((int64_t)x << 24) & 0x0000ff0000000000LL) | (((int64_t)x << 8) & 0x000000ff00000000LL) | \
-                    (((int64_t)x >> 8) & 0x00000000ff000000LL) | (((int64_t)x >> 24) & 0x0000000000ff0000LL) | \
-                    (((int64_t)x >> 40) & 0x000000000000ff00LL) | (((int64_t)x >> 56) & 0x00000000000000ffLL)))
+#define BSWAP16(x) bswap_16(x)
+#define BSWAP32(x) bswap_32(x)
+#define BSWAP64(x) bswap_64(x)
 
-#if defined(__i386__)
-#define TARGET_RT_LITTLE_ENDIAN 1
-#elif defined(__x86_64__)
-#define TARGET_RT_LITTLE_ENDIAN 1
-#elif defined (TARGET_OS_WIN32)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define TARGET_RT_LITTLE_ENDIAN 1
 #endif
 
Index: codec/ALACAudioTypes.h
===================================================================
--- codec/ALACAudioTypes.h.orig
+++ codec/ALACAudioTypes.h
@@ -42,10 +42,9 @@ extern "C" {
 #endif
 
 #include <stdint.h>
+#include <endian.h>
 
-#if defined(__ppc__)
-#define TARGET_RT_BIG_ENDIAN 1
-#elif defined(__ppc64__)
+#if __BYTE_ORDER == __BIG_ENDIAN
 #define TARGET_RT_BIG_ENDIAN 1
 #endif