[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56F772FA.1030104@gmail.com>
Date: Sun, 27 Mar 2016 13:43:22 +0800
From: "zhaoxiu.zeng" <zhaoxiu.zeng@...il.com>
To: Richard Henderson <rth@...ddle.net>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Matt Turner <mattst88@...il.com>,
Zeng Zhaoxiu <zhaoxiu.zeng@...il.com>,
linux-alpha@...r.kernel.org
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 03/31] Add alpha-specific parity functions
From: Zeng Zhaoxiu <zhaoxiu.zeng@...il.com>
Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@...il.com>
---
arch/alpha/include/asm/bitops.h | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h
index 4bdfbd4..95a43fa 100644
--- a/arch/alpha/include/asm/bitops.h
+++ b/arch/alpha/include/asm/bitops.h
@@ -421,11 +421,38 @@ static inline unsigned int __arch_hweight8(unsigned int w)
{
return __arch_hweight64(w & 0xff);
}
+
+static inline unsigned int __arch_parity64(unsigned long w)
+{
+ return (unsigned int)__kernel_ctpop(w) & 1;
+}
+
+static inline unsigned int __arch_parity32(unsigned int w)
+{
+ return __arch_parity64(w);
+}
+
+static inline unsigned int __arch_parity16(unsigned int w)
+{
+ return __arch_parity64(w & 0xffff);
+}
+
+static inline unsigned int __arch_parity8(unsigned int w)
+{
+ return __arch_parity64(w & 0xff);
+}
+
+static inline unsigned int __arch_parity4(unsigned int w)
+{
+ return __arch_parity64(w & 0xf);
+}
#else
#include <asm-generic/bitops/arch_hweight.h>
+#include <asm-generic/bitops/arch_parity.h>
#endif
#include <asm-generic/bitops/const_hweight.h>
+#include <asm-generic/bitops/const_parity.h>
#endif /* __KERNEL__ */
--
2.5.5
Powered by blists - more mailing lists