diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2006-12-08 05:36:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:39 -0500 |
commit | a5cfc1ec58a07074dacb6aa8c79eff864c966d12 (patch) | |
tree | 5fbb16ee570ec1d9a9f6adbc7a5cc963e7ca93d8 /include | |
parent | 30e25b71e725b150585e17888b130e3324f8cf7c (diff) |
[PATCH] bit reverse library
This patch provides two bit reverse functions and bit reverse table.
- reverse the order of bits in a u32 value
u8 bitrev8(u8 x);
- reverse the order of bits in a u32 value
u32 bitrev32(u32 x);
- byte reverse table
const u8 byte_rev_table[256];
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bitrev.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/bitrev.h b/include/linux/bitrev.h new file mode 100644 index 000000000000..05e540d6963a --- /dev/null +++ b/include/linux/bitrev.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _LINUX_BITREV_H | ||
2 | #define _LINUX_BITREV_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | extern u8 const byte_rev_table[256]; | ||
7 | |||
8 | static inline u8 bitrev8(u8 byte) | ||
9 | { | ||
10 | return byte_rev_table[byte]; | ||
11 | } | ||
12 | |||
13 | extern u32 bitrev32(u32 in); | ||
14 | |||
15 | #endif /* _LINUX_BITREV_H */ | ||