aboutsummaryrefslogtreecommitdiff
path: root/e2fsck/crc32.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-08-22 19:19:18 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-08-22 19:19:18 -0400
commit094c2d43939533113ededfd6fe49ad1c7726df29 (patch)
treeee104967ca7a768d69cca3a6b46efb13de6e4b40 /e2fsck/crc32.c
parent9c460caae3dab7803c0e7d9399b47e790cf90661 (diff)
downloade2fsprogs-094c2d43939533113ededfd6fe49ad1c7726df29.tar.gz
e2fsck: Portability fix: Use WORDS_BIGENDIAN instead of __LITTLE_ENDIAN
__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>
Diffstat (limited to 'e2fsck/crc32.c')
-rw-r--r--e2fsck/crc32.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/e2fsck/crc32.c b/e2fsck/crc32.c
index e9fd244f..f46295e1 100644
--- a/e2fsck/crc32.c
+++ b/e2fsck/crc32.c
@@ -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);