From: Joakim Tjernlund Date: Mon, 24 May 2010 21:33:31 +0000 (-0700) Subject: crc32: use __BYTE_ORDER macro for endian detection. X-Git-Tag: v2.6.35-rc1~305 X-Git-Url: http://ftp.safe.ca/?p=safe%2Fjmp%2Flinux-2.6;a=commitdiff_plain;h=4762bbc1a3a1f22095278b74dd1b8cee04858641 crc32: use __BYTE_ORDER macro for endian detection. 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/crc32.c b/lib/crc32.c index 4855995..3087ed8 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -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] ^ \