Messages in this thread Patch in this message | | | Subject | [PATCH 04/31] Add avr32-specific parity functions | From | "zhaoxiu.zeng" <> | Date | Sun, 27 Mar 2016 13:47:02 +0800 |
| |
From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> --- arch/avr32/include/asm/bitops.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/arch/avr32/include/asm/bitops.h b/arch/avr32/include/asm/bitops.h index 910d537..80d7005 100644 --- a/arch/avr32/include/asm/bitops.h +++ b/arch/avr32/include/asm/bitops.h @@ -300,6 +300,38 @@ static inline int ffs(unsigned long word) #include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/lock.h> +static inline unsigned int __arch_parity4(unsigned int w) +{ + w ^= w >> 2; + w ^= w >> 1; + return w & 1; +} + +static inline unsigned int __arch_parity8(unsigned int w) +{ + w ^= w >> 4; + return __arch_parity4(w); +} + +static inline unsigned int __arch_parity16(unsigned int w) +{ + w ^= w >> 8; + return __arch_parity8(w); +} + +static inline unsigned int __arch_parity32(unsigned int w) +{ + w ^= w >> 16; + return __arch_parity16(w); +} + +static inline unsigned int __arch_parity64(__u64 w) +{ + return __arch_parity32((unsigned int)(w >> 32) ^ (unsigned int)w); +} + +#include <asm-generic/bitops/const_parity.h> + extern unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset); #define find_next_zero_bit_le find_next_zero_bit_le -- 2.5.5
| |