lkml.org 
[lkml]   [2016]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 11/31] Add x86-specific parity functions
From
Date
From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@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
\
 
 \ /
  Last update: 2016-03-27 09:01    [W:0.228 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site