From: Theodore Ts'o Date: Fri, 22 Aug 2008 23:19:18 +0000 (-0400) Subject: e2fsck: Portability fix: Use WORDS_BIGENDIAN instead of __LITTLE_ENDIAN X-Git-Tag: v1.41.1~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=094c2d43939533113ededfd6fe49ad1c7726df29;p=thirdparty%2Fe2fsprogs.git 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" --- diff --git a/e2fsck/crc32.c b/e2fsck/crc32.c index e9fd244f4..f46295e12 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);