Whamcloud - gitweb
LU-4674 endianness: Fix __{LITTLE,BIG}_ENDIAN macro usage
[fs/lustre-release.git] / libcfs / libcfs / posix / posix-crc32.c
index 972c5ff..4937c8c 100644 (file)
@@ -2,6 +2,7 @@
  *      This file contains part of linux kernel implementation of crc32
  *      kernel version 2.6.32
  */
+#include <endian.h>
 #include <libcfs/libcfs.h>
 #define CRCPOLY_LE      0xedb88320
 #define CRC_LE_BITS     8
@@ -34,7 +35,7 @@ unsigned int crc32_le(unsigned int crc, unsigned char const *p, size_t len)
        const unsigned int      *b = (unsigned int *)p;
        const unsigned int      *tab = crc32table_le;
 
-# ifdef __LITTLE_ENDIAN
+# if __BYTE_ORDER == __LITTLE_ENDIAN
 #  define DO_CRC(x) crc = tab[(crc ^ (x)) & 255] ^ (crc>>8)
 # else
 #  define DO_CRC(x) crc = tab[((crc >> 24) ^ (x)) & 255] ^ (crc<<8)