Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1378426 > unrolled thread

[PATCH V3 12/29] bch: use parity32

Started byzengzhaoxiu@163.com
First post2016-04-14 05:10 +0200
Last post2016-04-14 05:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V3 12/29] bch: use parity32 zengzhaoxiu@163.com - 2016-04-14 05:10 +0200

#1378426 — [PATCH V3 12/29] bch: use parity32

Fromzengzhaoxiu@163.com
Date2016-04-14 05:10 +0200
Subject[PATCH V3 12/29] bch: use parity32
Message-ID<rnFPj-3p3-7@gated-at.bofh.it>
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web