Skip to content

Commit

Permalink
crc32: use __BYTE_ORDER macro for endian detection.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
joakim-tjernlund authored and torvalds committed May 25, 2010
1 parent 836e2af commit 4762bbc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] ^ \
Expand Down

0 comments on commit 4762bbc

Please sign in to comment.