lkml.org 
[lkml]   [2010]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] crc32: use __BYTE_ORDER macro for endian detection.
Date
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>
---
lib/crc32.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/crc32.c b/lib/crc32.c
index 54ca885..89b0624 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -51,7 +51,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 ] ^ \
--
1.6.4.4


\
 
 \ /
  Last update: 2010-04-22 17:27    [W:0.031 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site