]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: Portability fix: Use WORDS_BIGENDIAN instead of __LITTLE_ENDIAN
authorTheodore Ts'o <tytso@mit.edu>
Fri, 22 Aug 2008 23:19:18 +0000 (19:19 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 22 Aug 2008 23:19:18 +0000 (19:19 -0400)
__LITTLE_ENDIAN is set by the glibc headers, and isn't portable.  We
should be using WORDS_BIGENDIAN, which is set by autoconf.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/crc32.c

index e9fd244f4c13fa6d91964c685abd9c3aecddb12a..f46295e1217f24732ab2e3487239196943e48760 100644 (file)
@@ -83,10 +83,10 @@ __u32 crc32_le(__u32 crc, unsigned char const *p, size_t len)
        const __u32      *b =(__u32 *)p;
        const __u32      *tab = crc32table_le;
 
-# ifdef __LITTLE_ENDIAN
-#  define DO_CRC(x) crc = tab[ (crc ^ (x)) & 255 ] ^ (crc>>8)
-# else
+# ifdef WORDS_BIGENDIAN
 #  define DO_CRC(x) crc = tab[ ((crc >> 24) ^ (x)) & 255] ^ (crc<<8)
+# else
+#  define DO_CRC(x) crc = tab[ (crc ^ (x)) & 255 ] ^ (crc>>8)
 # endif
 
        crc = __cpu_to_le32(crc);
@@ -183,10 +183,10 @@ __u32 crc32_be(__u32 crc, unsigned char const *p, size_t len)
        const __u32      *b =(const __u32 *)p;
        const __u32      *tab = crc32table_be;
 
-# ifdef __LITTLE_ENDIAN
-#  define DO_CRC(x) crc = tab[ (crc ^ (x)) & 255 ] ^ (crc>>8)
-# else
+# ifdef WORDS_BIGENDIAN
 #  define DO_CRC(x) crc = tab[ ((crc >> 24) ^ (x)) & 255] ^ (crc<<8)
+# else
+#  define DO_CRC(x) crc = tab[ (crc ^ (x)) & 255 ] ^ (crc>>8)
 # endif
 
        crc = __cpu_to_be32(crc);