aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Schlichting <fsfs@debian.org>2013-11-21 22:56:45 +0100
committerMax Kellermann <max@duempel.org>2013-11-21 23:04:49 +0100
commit51ec499c89ae62f366fbdfe08c87a05384905e2e (patch)
tree8c201a759d6808438854a793b7970b9916d840ba
parent3a4df25db239bbd998a9bf5825567f7e46b7b04c (diff)
downloadmpd-51ec499c89ae62f366fbdfe08c87a05384905e2e.tar.gz
mpd-51ec499c89ae62f366fbdfe08c87a05384905e2e.tar.xz
mpd-51ec499c89ae62f366fbdfe08c87a05384905e2e.zip
system/ByteOrder: testing for endianness in a more general way
Fixes build tests on ia64 and mipsel by testing for endianness in a more general / portable way.
Diffstat (limited to '')
-rw-r--r--NEWS1
-rw-r--r--src/system/ByteOrder.hxx12
2 files changed, 12 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 3056bf915..8fc7435ae 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
ver 0.18.5 (20??/??/??)
* decoder
- fluidsynth: auto-detect by default
+* fix ia64, mipsel and other little-endian architectures
* fix build failures due to missing includes
* fix build failure with static libmpdclient
diff --git a/src/system/ByteOrder.hxx b/src/system/ByteOrder.hxx
index 2124e92db..8beda61c7 100644
--- a/src/system/ByteOrder.hxx
+++ b/src/system/ByteOrder.hxx
@@ -36,10 +36,20 @@
/* well-known little-endian */
# define IS_LITTLE_ENDIAN true
# define IS_BIG_ENDIAN false
-#else
+#elif defined(__MIPSEB__)
/* well-known big-endian */
# define IS_LITTLE_ENDIAN false
# define IS_BIG_ENDIAN true
+#else
+/* generic compile-time check */
+# include <endian.h>
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define IS_LITTLE_ENDIAN true
+# define IS_BIG_ENDIAN false
+# else
+# define IS_LITTLE_ENDIAN false
+# define IS_BIG_ENDIAN true
+# endif
#endif
static inline constexpr bool