[PATCH 04/31] Add avr32-specific parity functions

From: zhaoxiu.zeng
Date: Sun Mar 27 2016 - 01:47:40 EST


From: Zeng Zhaoxiu <zhaoxiu.zeng@xxxxxxxxx>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@xxxxxxxxx>
---
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