summaryrefslogtreecommitdiff
path: root/utils/porting.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-02-09 22:51:27 +0000
committerMike Frysinger <vapier@gentoo.org>2009-02-09 22:51:27 +0000
commit14fd4a3a31fc736f125c8cfd7fa827a310712135 (patch)
treede6fcd07e83b1301bb5bce9b04f88a026b458354 /utils/porting.h
parent32242e7e10276157533def1c92c4c720945510fc (diff)
unify byte order cruft in bswap.h and porting.h and add a bswap_64() replacement
Diffstat (limited to 'utils/porting.h')
-rw-r--r--utils/porting.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/utils/porting.h b/utils/porting.h
index 9a47851d4..becd7acaa 100644
--- a/utils/porting.h
+++ b/utils/porting.h
@@ -44,13 +44,23 @@
# define UCLIBC_RUNTIME_PREFIX "/"
#endif
+#undef UCLIBC_ENDIAN_HOST
#define UCLIBC_ENDIAN_LITTLE 1234
#define UCLIBC_ENDIAN_BIG 4321
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_LITTLE
-#elif __BYTE_ORDER == __BIG_ENDIAN
-# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_BIG
-#else
+#if defined(BYTE_ORDER)
+# if BYTE_ORDER == LITTLE_ENDIAN
+# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_LITTLE
+# elif BYTE_ORDER == BIG_ENDIAN
+# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_BIG
+# endif
+#elif defined(__BYTE_ORDER)
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_LITTLE
+# elif __BYTE_ORDER == __BIG_ENDIAN
+# define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_BIG
+# endif
+#endif
+#if !defined(UCLIBC_ENDIAN_HOST)
# error "Unknown host byte order!"
#endif