Skip to contentSkip to conversation

bit revese library

PATCH In review Akinobu Mita 2 participants 2 messages Oct 18, 2006 – Oct 23, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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];
 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
Index: work-fault-inject/include/linux/bitrev.h
===================================================================
@@ -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
Index: work-fault-inject/lib/Kconfig
===================================================================
@@ -4,6 +4,9 @@
 
 menu "Library routines"
 
+config BITREVERSE
+	tristate
+
 config CRC_CCITT
 	tristate "CRC-CCITT functions"
 	help
lib/Makefile +1 -0
Index: work-fault-inject/lib/Makefile
===================================================================
@@ -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

#1 lore raw
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