bit revese library
Subsystems (2)
PATCH 1/6 bit revese 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 <[email protected]>
include/linux/bitrev.h | 15 +++++++++++++ lib/Kconfig | 3 ++ lib/Makefile | 1 lib/bitrev.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+)
include/linux/bitrev.h new file +15 -0
@@ -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 */
lib/Kconfig +3 -0
@@ -4,6 +4,9 @@ menu "Library routines" +config BITREVERSE + tristate + config CRC_CCITT tristate "CRC-CCITT functions" help
lib/Makefile +1 -0
@@ -35,6 +35,7 @@ ifneq ($(CONFIG_HAVE_DEC_LOCK),y) lib-y += dec_and_lock.o endif +obj-$(CONFIG_BITREVERSE) += bitrev.o obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o obj-$(CONFIG_CRC16) += crc16.o obj-$(CONFIG_CRC32) += crc32.o
lib/bitrev.c new file +54 -0
54 lines not on this page · raw message
Quoted 1 line · Akinobu Mita
This patch provides two bit reverse functions and bit reverse table.
drivers/isdn/gigaset/common.c also contains a private bit reverse table, gigaset_invtab[256]. Would you mind extending your patchset to convert that to your functions, too?
Thanks
Tilman