| 1 |
|
| 2 | #ifndef _ASM_GENERIC_BITOPS___BITREV_H_
|
| 3 | #define _ASM_GENERIC_BITOPS___BITREV_H_
|
| 4 |
|
| 5 | #include <asm/types.h>
|
| 6 |
|
| 7 | extern u8 const byte_rev_table[256];
|
| 8 | static __always_inline __attribute_const__ u8 generic___bitrev8(u8 byte)
|
| 9 | {
|
| 10 | return byte_rev_table[byte];
|
| 11 | }
|
| 12 |
|
| 13 | static __always_inline __attribute_const__ u16 generic___bitrev16(u16 x)
|
| 14 | {
|
| 15 | return (generic___bitrev8(x & 0xff) << 8) | generic___bitrev8(x >> 8);
|
| 16 | }
|
| 17 |
|
| 18 | static __always_inline __attribute_const__ u32 generic___bitrev32(u32 x)
|
| 19 | {
|
| 20 | return (generic___bitrev16(x & 0xffff) << 16) | generic___bitrev16(x >> 16);
|
| 21 | }
|
| 22 |
|
| 23 | #endif
|