#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)
*/
(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)
#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)
#define be32_to_cpu(x) swab32(x)
#define be64_to_cpu(x) swab64(x)
-#endif /* !WORDS_BIGENDIAN */
+#endif /* __BYTE_ORDER */
#endif /* BITOPS_H */