summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2008-12-08 11:16:37 +0100
committerKarel Zak2008-12-08 11:16:37 +0100
commit8bce47d976e599a6e05106e8bc05c4270cc7810e (patch)
treef991d080251a5ff08258f2ad205f3aac3d68ed83
parentlib: add __BYTE_ORDER to md5.c (diff)
downloadkernel-qcow2-util-linux-8bce47d976e599a6e05106e8bc05c4270cc7810e.tar.gz
kernel-qcow2-util-linux-8bce47d976e599a6e05106e8bc05c4270cc7810e.tar.xz
kernel-qcow2-util-linux-8bce47d976e599a6e05106e8bc05c4270cc7810e.zip
include: use __BYTE_ORDER rather than AC specific WORDS_BIGENDIAN
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--configure.ac1
-rw-r--r--include/bitops.h10
2 files changed, 7 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 35d60e8b5..3bbfd5736 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,6 @@ esac
AC_PROG_CC_STDC
AC_GNU_SOURCE
AC_CANONICAL_HOST
-AC_C_BIGENDIAN
linux_os=no
case ${host_os} in
diff --git a/include/bitops.h b/include/bitops.h
index 62deadc70..f05cbdb9d 100644
--- a/include/bitops.h
+++ b/include/bitops.h
@@ -3,6 +3,10 @@
#include <stdint.h>
+#if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN)
+#error missing __BYTE_ORDER
+#endif
+
/*
* Byte swab macros (based on linux/byteorder/swab.h)
*/
@@ -30,7 +34,7 @@
(uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) ))
-#ifdef WORDS_BIGENDIAN
+#if (__BYTE_ORDER == __BIG_ENDIAN)
#define cpu_to_le16(x) swab16(x)
#define cpu_to_le32(x) swab32(x)
@@ -46,7 +50,7 @@
#define be32_to_cpu(x) (x)
#define be64_to_cpu(x) (x)
-#else /* !WORDS_BIGENDIAN */
+#else /* __BYTE_ORDER != __BIG_ENDIAN */
#define cpu_to_le16(x) (x)
#define cpu_to_le32(x) (x)
@@ -62,7 +66,7 @@
#define be32_to_cpu(x) swab32(x)
#define be64_to_cpu(x) swab64(x)
-#endif /* !WORDS_BIGENDIAN */
+#endif /* __BYTE_ORDER */
#endif /* BITOPS_H */