crc32: use __BYTE_ORDER macro for endian detection.
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Mon, 24 May 2010 21:33:31 +0000 (14:33 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 May 2010 15:07:06 +0000 (08:07 -0700)
Since crc32.c contains a nifty test program that can be executed in user
space, make sure endian detection works reliably in user space too.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/crc32.c

index 4855995fcde9dc1b57a853549beb45ada94b013d..3087ed899ee34c48f71249eeb98c4880bcd3a87f 100644 (file)
@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL");
 static inline u32
 crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256])
 {
-# ifdef __LITTLE_ENDIAN
+# if __BYTE_ORDER == __LITTLE_ENDIAN
 #  define DO_CRC(x) crc = tab[0][(crc ^ (x)) & 255] ^ (crc >> 8)
 #  define DO_CRC4 crc = tab[3][(crc) & 255] ^ \
                tab[2][(crc >> 8) & 255] ^ \