mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[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>
This commit is contained in:
parent
30e25b71e7
commit
a5cfc1ec58
4 changed files with 73 additions and 0 deletions
15
include/linux/bitrev.h
Normal file
15
include/linux/bitrev.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#ifndef _LINUX_BITREV_H
|
||||
#define _LINUX_BITREV_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
extern u8 const byte_rev_table[256];
|
||||
|
||||
static inline u8 bitrev8(u8 byte)
|
||||
{
|
||||
return byte_rev_table[byte];
|
||||
}
|
||||
|
||||
extern u32 bitrev32(u32 in);
|
||||
|
||||
#endif /* _LINUX_BITREV_H */
|
Loading…
Add table
Add a link
Reference in a new issue