Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752719AbcC0FoB (ORCPT ); Sun, 27 Mar 2016 01:44:01 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:32850 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750701AbcC0Fnw (ORCPT ); Sun, 27 Mar 2016 01:43:52 -0400 Subject: [PATCH 03/31] Add alpha-specific parity functions To: Richard Henderson , Ivan Kokshaysky , Matt Turner , Zeng Zhaoxiu , linux-alpha@vger.kernel.org References: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com> Cc: "linux-kernel@vger.kernel.org" From: "zhaoxiu.zeng" Message-ID: <56F772FA.1030104@gmail.com> Date: Sun, 27 Mar 2016 13:43:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1275 Lines: 52 From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- 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 +#include #endif #include +#include #endif /* __KERNEL__ */ -- 2.5.5