diff options
Diffstat (limited to 'arch/arm64/include/asm')
-rw-r--r-- | arch/arm64/include/asm/bitrev.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/bitrev.h b/arch/arm64/include/asm/bitrev.h new file mode 100644 index 000000000000..a5a0c3660137 --- /dev/null +++ b/arch/arm64/include/asm/bitrev.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __ASM_BITREV_H | ||
2 | #define __ASM_BITREV_H | ||
3 | static __always_inline __attribute_const__ u32 __arch_bitrev32(u32 x) | ||
4 | { | ||
5 | __asm__ ("rbit %w0, %w1" : "=r" (x) : "r" (x)); | ||
6 | return x; | ||
7 | } | ||
8 | |||
9 | static __always_inline __attribute_const__ u16 __arch_bitrev16(u16 x) | ||
10 | { | ||
11 | return __arch_bitrev32((u32)x) >> 16; | ||
12 | } | ||
13 | |||
14 | static __always_inline __attribute_const__ u8 __arch_bitrev8(u8 x) | ||
15 | { | ||
16 | return __arch_bitrev32((u32)x) >> 24; | ||
17 | } | ||
18 | |||
19 | #endif | ||