Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754817AbcC0HCT (ORCPT ); Sun, 27 Mar 2016 03:02:19 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34465 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338AbcC0HCI (ORCPT ); Sun, 27 Mar 2016 03:02:08 -0400 Subject: [PATCH 14/31] lib: bch: use parity32 References: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com> Cc: linux-kernel@vger.kernel.org From: "zhaoxiu.zeng" Message-ID: <56F78567.6060406@gmail.com> Date: Sun, 27 Mar 2016 15:01:59 +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 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1059 Lines: 41 From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- lib/bch.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/bch.c b/lib/bch.c index bc89dfe4..6c6e8d4 100644 --- a/lib/bch.c +++ b/lib/bch.c @@ -278,18 +278,6 @@ static inline int deg(unsigned int poly) return fls(poly)-1; } -static inline int parity(unsigned int x) -{ - /* - * public domain code snippet, lifted from - * http://www-graphics.stanford.edu/~seander/bithacks.html - */ - x ^= x >> 1; - x ^= x >> 2; - x = (x & 0x11111111U) * 0x11111111U; - return (x >> 28) & 1; -} - /* Galois field basic operations: multiply, divide, inverse, etc. */ static inline unsigned int gf_mul(struct bch_control *bch, unsigned int a, @@ -494,7 +482,7 @@ static int solve_linear_system(struct bch_control *bch, unsigned int *rows, tmp = 0; for (r = m-1; r >= 0; r--) { mask = rows[r] & (tmp|1); - tmp |= parity(mask) << (m-r); + tmp |= parity32(mask) << (m-r); } sol[p] = tmp >> 1; } -- 2.5.5