lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 27 Mar 2016 14:45:50 +0800
From:	"zhaoxiu.zeng" <zhaoxiu.zeng@...il.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Denys Vlasenko <dvlasenk@...hat.com>
Cc:	linux-kernel@...r.kernel.org, x86@...nel.org
Subject: [PATCH 11/31] Add x86-specific parity functions

From: Zeng Zhaoxiu <zhaoxiu.zeng@...il.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ