]> err.no Git - util-linux/commitdiff
include: use __BYTE_ORDER rather than AC specific WORDS_BIGENDIAN
authorKarel Zak <kzak@redhat.com>
Mon, 8 Dec 2008 10:16:37 +0000 (11:16 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 8 Dec 2008 10:16:37 +0000 (11:16 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
include/bitops.h

index 35d60e8b5849aa804f620c41c537c8badcf1f8e7..3bbfd5736ddf9d7b41bfff379b6c179d13d029f8 100644 (file)
@@ -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
index 62deadc709cdbf25f8d498a9ecd9dc80fd21e136..f05cbdb9d0e31bd35204cd02d9b8ff85e0311f04 100644 (file)
@@ -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 */