From: "zhaoxiu.zeng" <zhaoxiu.zeng@gmail.com>
To: Tony Luck <tony.luck@intel.com>, Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: [PATCH 06/31] Add ia64-specific parity functions
Date: Sun, 27 Mar 2016 06:00:02 +0000 [thread overview]
Message-ID: <56F776E2.4090609@gmail.com> (raw)
In-Reply-To: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>
From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
---
arch/ia64/include/asm/bitops.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h
index 71e8145..de13d89 100644
--- a/arch/ia64/include/asm/bitops.h
+++ b/arch/ia64/include/asm/bitops.h
@@ -439,6 +439,22 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
#include <asm-generic/bitops/const_hweight.h>
+/*
+ * parityN: returns the parity of a N-bit word,
+ * i.e. the number of 1-bits in x modulo 2.
+ */
+static __inline__ unsigned int __arch_parity64(unsigned long x)
+{
+ return (unsigned int)ia64_popcnt(x) & 1;
+}
+
+#define __arch_parity32(x) ((unsigned int) __arch_parity64((x) & 0xfffffffful))
+#define __arch_parity16(x) ((unsigned int) __arch_parity64((x) & 0xfffful))
+#define __arch_parity8(x) ((unsigned int) __arch_parity64((x) & 0xfful))
+#define __arch_parity4(x) ((unsigned int) __arch_parity64((x) & 0xful))
+
+#include <asm-generic/bitops/const_parity.h>
+
#endif /* __KERNEL__ */
#include <asm-generic/bitops/find.h>
--
2.5.5
parent reply other threads:[~2016-03-27 6:00 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56F776E2.4090609@gmail.com \
--to=zhaoxiu.zeng@gmail.com \
--cc=fenghua.yu@intel.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox