mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-02 18:17:50 -04:00
ARM: 8187/1: add CONFIG_HAVE_ARCH_BITREVERSE to support rbit instruction
this change add CONFIG_HAVE_ARCH_BITREVERSE config option, so that we can use some architecture's bitrev hardware instruction to do bitrev operation. Introduce __constant_bitrev* macro for constant bitrev operation. Change __bitrev16() __bitrev32() to be inline function, don't need export symbol for these tiny functions. Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
17
lib/bitrev.c
17
lib/bitrev.c
@@ -1,3 +1,4 @@
|
||||
#ifndef CONFIG_HAVE_ARCH_BITREVERSE
|
||||
#include <linux/types.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/bitrev.h>
|
||||
@@ -42,18 +43,4 @@ const u8 byte_rev_table[256] = {
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(byte_rev_table);
|
||||
|
||||
u16 bitrev16(u16 x)
|
||||
{
|
||||
return (bitrev8(x & 0xff) << 8) | bitrev8(x >> 8);
|
||||
}
|
||||
EXPORT_SYMBOL(bitrev16);
|
||||
|
||||
/**
|
||||
* bitrev32 - reverse the order of bits in a u32 value
|
||||
* @x: value to be bit-reversed
|
||||
*/
|
||||
u32 bitrev32(u32 x)
|
||||
{
|
||||
return (bitrev16(x & 0xffff) << 16) | bitrev16(x >> 16);
|
||||
}
|
||||
EXPORT_SYMBOL(bitrev32);
|
||||
#endif /* CONFIG_HAVE_ARCH_BITREVERSE */
|
||||
|
||||
Reference in New Issue
Block a user