Paul Burton | 87321fd | 2016-05-06 13:35:03 +0100 | [diff] [blame] | 1 | #ifndef __MIPS_ASM_BITREV_H__ |
| 2 | #define __MIPS_ASM_BITREV_H__ |
| 3 | |
| 4 | #include <linux/swab.h> |
| 5 | |
| 6 | static __always_inline __attribute_const__ u32 __arch_bitrev32(u32 x) |
| 7 | { |
| 8 | u32 ret; |
| 9 | |
| 10 | asm("bitswap %0, %1" : "=r"(ret) : "r"(__swab32(x))); |
| 11 | return ret; |
| 12 | } |
| 13 | |
| 14 | static __always_inline __attribute_const__ u16 __arch_bitrev16(u16 x) |
| 15 | { |
| 16 | u16 ret; |
| 17 | |
| 18 | asm("bitswap %0, %1" : "=r"(ret) : "r"(__swab16(x))); |
| 19 | return ret; |
| 20 | } |
| 21 | |
| 22 | static __always_inline __attribute_const__ u8 __arch_bitrev8(u8 x) |
| 23 | { |
| 24 | u8 ret; |
| 25 | |
| 26 | asm("bitswap %0, %1" : "=r"(ret) : "r"(x)); |
| 27 | return ret; |
| 28 | } |
| 29 | |
| 30 | #endif /* __MIPS_ASM_BITREV_H__ */ |