diff options
author | Patrick Mochel <mochel@osdl.org> | 2003-01-03 22:54:29 -0600 |
---|---|---|
committer | Patrick Mochel <mochel@osdl.org> | 2003-01-03 22:54:29 -0600 |
commit | 8624ae3d2d3928a83d54585dd053583d81d781f2 (patch) | |
tree | 852d8331f5f12d5040c6fa7d22d1c49aeb41b67c /lib | |
parent | 6223578142a8216a64063d22903ae215d885fb32 (diff) | |
parent | 6b4e1e926ae0ee936914e4fd729382af433938fb (diff) | |
download | history-8624ae3d2d3928a83d54585dd053583d81d781f2.tar.gz |
Merge bk://linux.bkbits.net/linux-2.5
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
Diffstat (limited to 'lib')
-rw-r--r-- | lib/crc32.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/crc32.c b/lib/crc32.c index 47a142688b1d18..b3defb2db34563 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -265,8 +265,19 @@ u32 attribute((pure)) crc32_be(u32 crc, unsigned char const *p, size_t len) } #endif +u32 bitreverse(u32 x) +{ + x = (x >> 16) | (x << 16); + x = (x >> 8 & 0x00ff00ff) | (x << 8 & 0xff00ff00); + x = (x >> 4 & 0x0f0f0f0f) | (x << 4 & 0xf0f0f0f0); + x = (x >> 2 & 0x33333333) | (x << 2 & 0xcccccccc); + x = (x >> 1 & 0x55555555) | (x << 1 & 0xaaaaaaaa); + return x; +} + EXPORT_SYMBOL(crc32_le); EXPORT_SYMBOL(crc32_be); +EXPORT_SYMBOL(bitreverse); /* * A brief CRC tutorial. @@ -412,16 +423,6 @@ buf_dump(char const *prefix, unsigned char const *buf, size_t len) } #endif -static u32 attribute((const)) bitreverse(u32 x) -{ - x = (x >> 16) | (x << 16); - x = (x >> 8 & 0x00ff00ff) | (x << 8 & 0xff00ff00); - x = (x >> 4 & 0x0f0f0f0f) | (x << 4 & 0xf0f0f0f0); - x = (x >> 2 & 0x33333333) | (x << 2 & 0xcccccccc); - x = (x >> 1 & 0x55555555) | (x << 1 & 0xaaaaaaaa); - return x; -} - static void bytereverse(unsigned char *buf, size_t len) { while (len--) { |