Commit 4762bbc1 authored by Joakim Tjernlund's avatar Joakim Tjernlund Committed by Linus Torvalds

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: default avatarJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 836e2af9
...@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL"); ...@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL");
static inline u32 static inline u32
crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256]) 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_CRC(x) crc = tab[0][(crc ^ (x)) & 255] ^ (crc >> 8)
# define DO_CRC4 crc = tab[3][(crc) & 255] ^ \ # define DO_CRC4 crc = tab[3][(crc) & 255] ^ \
tab[2][(crc >> 8) & 255] ^ \ tab[2][(crc >> 8) & 255] ^ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment