From: Zeng Zhaoxiu <zhaoxiu.z...@gmail.com>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.z...@gmail.com>
---
 arch/x86/include/asm/bitops.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index 7766d1c..d3210c0 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -501,6 +501,18 @@ static __always_inline int fls64(__u64 x)
 
 #include <asm-generic/bitops/const_hweight.h>
 
+#define __arch_parity32(x) (__arch_hweight32(x) & 1)
+#define __arch_parity4(x)  (__arch_parity32((x) & 0xf))
+#define __arch_parity8(x)  (__arch_parity32((x) & 0xff))
+#define __arch_parity16(x) (__arch_parity32((x) & 0xffff))
+#ifdef CONFIG_X86_32
+#define __arch_parity64(x) (__arch_parity32((unsigned int)((x) >> 32) ^ 
(unsigned int)(x)))
+#else
+#define __arch_parity64(x) (__arch_hweight64(x) & 1)
+#endif
+
+#include <asm-generic/bitops/const_parity.h>
+
 #include <asm-generic/bitops/le.h>
 
 #include <asm-generic/bitops/ext2-atomic-setbit.h>
-- 
2.5.5

Reply via email to