1 |
Index: codec/EndianPortable.c |
2 |
=================================================================== |
3 |
--- codec/EndianPortable.c.orig |
4 |
+++ codec/EndianPortable.c |
5 |
@@ -25,20 +25,15 @@ |
6 |
// |
7 |
|
8 |
#include <stdio.h> |
9 |
+#include <byteswap.h> |
10 |
+#include <endian.h> |
11 |
#include "EndianPortable.h" |
12 |
|
13 |
-#define BSWAP16(x) (((x << 8) | ((x >> 8) & 0x00ff))) |
14 |
-#define BSWAP32(x) (((x << 24) | ((x << 8) & 0x00ff0000) | ((x >> 8) & 0x0000ff00) | ((x >> 24) & 0x000000ff))) |
15 |
-#define BSWAP64(x) ((((int64_t)x << 56) | (((int64_t)x << 40) & 0x00ff000000000000LL) | \ |
16 |
- (((int64_t)x << 24) & 0x0000ff0000000000LL) | (((int64_t)x << 8) & 0x000000ff00000000LL) | \ |
17 |
- (((int64_t)x >> 8) & 0x00000000ff000000LL) | (((int64_t)x >> 24) & 0x0000000000ff0000LL) | \ |
18 |
- (((int64_t)x >> 40) & 0x000000000000ff00LL) | (((int64_t)x >> 56) & 0x00000000000000ffLL))) |
19 |
+#define BSWAP16(x) bswap_16(x) |
20 |
+#define BSWAP32(x) bswap_32(x) |
21 |
+#define BSWAP64(x) bswap_64(x) |
22 |
|
23 |
-#if defined(__i386__) |
24 |
-#define TARGET_RT_LITTLE_ENDIAN 1 |
25 |
-#elif defined(__x86_64__) |
26 |
-#define TARGET_RT_LITTLE_ENDIAN 1 |
27 |
-#elif defined (TARGET_OS_WIN32) |
28 |
+#if __BYTE_ORDER == __LITTLE_ENDIAN |
29 |
#define TARGET_RT_LITTLE_ENDIAN 1 |
30 |
#endif |
31 |
|
32 |
Index: codec/ALACAudioTypes.h |
33 |
=================================================================== |
34 |
--- codec/ALACAudioTypes.h.orig |
35 |
+++ codec/ALACAudioTypes.h |
36 |
@@ -42,10 +42,9 @@ extern "C" { |
37 |
#endif |
38 |
|
39 |
#include <stdint.h> |
40 |
+#include <endian.h> |
41 |
|
42 |
-#if defined(__ppc__) |
43 |
-#define TARGET_RT_BIG_ENDIAN 1 |
44 |
-#elif defined(__ppc64__) |
45 |
+#if __BYTE_ORDER == __BIG_ENDIAN |
46 |
#define TARGET_RT_BIG_ENDIAN 1 |
47 |
#endif |
48 |
|