aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reed_solomon/decode_rs.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2005-11-07 06:15:37 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-07 08:25:38 -0500
commit03ead8427d65f6986a8bf5fd3f29a879348780ad (patch)
treea70bff642d66eb3dbafd31e017f0f9783ffca6c2 /lib/reed_solomon/decode_rs.c
parent182ec4eee397543101a6db8906ed88727d3f7e53 (diff)
[LIB] reed_solomon: Clean up trailing white spaces
Diffstat (limited to 'lib/reed_solomon/decode_rs.c')
-rw-r--r--lib/reed_solomon/decode_rs.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c
index d401decd6289..a58df56f09b6 100644
--- a/lib/reed_solomon/decode_rs.c
+++ b/lib/reed_solomon/decode_rs.c
@@ -1,22 +1,22 @@
1/* 1/*
2 * lib/reed_solomon/decode_rs.c 2 * lib/reed_solomon/decode_rs.c
3 * 3 *
4 * Overview: 4 * Overview:
5 * Generic Reed Solomon encoder / decoder library 5 * Generic Reed Solomon encoder / decoder library
6 * 6 *
7 * Copyright 2002, Phil Karn, KA9Q 7 * Copyright 2002, Phil Karn, KA9Q
8 * May be used under the terms of the GNU General Public License (GPL) 8 * May be used under the terms of the GNU General Public License (GPL)
9 * 9 *
10 * Adaption to the kernel by Thomas Gleixner (tglx@linutronix.de) 10 * Adaption to the kernel by Thomas Gleixner (tglx@linutronix.de)
11 * 11 *
12 * $Id: decode_rs.c,v 1.6 2004/10/22 15:41:47 gleixner Exp $ 12 * $Id: decode_rs.c,v 1.7 2005/11/07 11:14:59 gleixner Exp $
13 * 13 *
14 */ 14 */
15 15
16/* Generic data width independent code which is included by the 16/* Generic data width independent code which is included by the
17 * wrappers. 17 * wrappers.
18 */ 18 */
19{ 19{
20 int deg_lambda, el, deg_omega; 20 int deg_lambda, el, deg_omega;
21 int i, j, r, k, pad; 21 int i, j, r, k, pad;
22 int nn = rs->nn; 22 int nn = rs->nn;
@@ -41,9 +41,9 @@
41 pad = nn - nroots - len; 41 pad = nn - nroots - len;
42 if (pad < 0 || pad >= nn) 42 if (pad < 0 || pad >= nn)
43 return -ERANGE; 43 return -ERANGE;
44 44
45 /* Does the caller provide the syndrome ? */ 45 /* Does the caller provide the syndrome ? */
46 if (s != NULL) 46 if (s != NULL)
47 goto decode; 47 goto decode;
48 48
49 /* form the syndromes; i.e., evaluate data(x) at roots of 49 /* form the syndromes; i.e., evaluate data(x) at roots of
@@ -54,11 +54,11 @@
54 for (j = 1; j < len; j++) { 54 for (j = 1; j < len; j++) {
55 for (i = 0; i < nroots; i++) { 55 for (i = 0; i < nroots; i++) {
56 if (syn[i] == 0) { 56 if (syn[i] == 0) {
57 syn[i] = (((uint16_t) data[j]) ^ 57 syn[i] = (((uint16_t) data[j]) ^
58 invmsk) & msk; 58 invmsk) & msk;
59 } else { 59 } else {
60 syn[i] = ((((uint16_t) data[j]) ^ 60 syn[i] = ((((uint16_t) data[j]) ^
61 invmsk) & msk) ^ 61 invmsk) & msk) ^
62 alpha_to[rs_modnn(rs, index_of[syn[i]] + 62 alpha_to[rs_modnn(rs, index_of[syn[i]] +
63 (fcr + i) * prim)]; 63 (fcr + i) * prim)];
64 } 64 }
@@ -70,7 +70,7 @@
70 if (syn[i] == 0) { 70 if (syn[i] == 0) {
71 syn[i] = ((uint16_t) par[j]) & msk; 71 syn[i] = ((uint16_t) par[j]) & msk;
72 } else { 72 } else {
73 syn[i] = (((uint16_t) par[j]) & msk) ^ 73 syn[i] = (((uint16_t) par[j]) & msk) ^
74 alpha_to[rs_modnn(rs, index_of[syn[i]] + 74 alpha_to[rs_modnn(rs, index_of[syn[i]] +
75 (fcr+i)*prim)]; 75 (fcr+i)*prim)];
76 } 76 }
@@ -99,14 +99,14 @@
99 99
100 if (no_eras > 0) { 100 if (no_eras > 0) {
101 /* Init lambda to be the erasure locator polynomial */ 101 /* Init lambda to be the erasure locator polynomial */
102 lambda[1] = alpha_to[rs_modnn(rs, 102 lambda[1] = alpha_to[rs_modnn(rs,
103 prim * (nn - 1 - eras_pos[0]))]; 103 prim * (nn - 1 - eras_pos[0]))];
104 for (i = 1; i < no_eras; i++) { 104 for (i = 1; i < no_eras; i++) {
105 u = rs_modnn(rs, prim * (nn - 1 - eras_pos[i])); 105 u = rs_modnn(rs, prim * (nn - 1 - eras_pos[i]));
106 for (j = i + 1; j > 0; j--) { 106 for (j = i + 1; j > 0; j--) {
107 tmp = index_of[lambda[j - 1]]; 107 tmp = index_of[lambda[j - 1]];
108 if (tmp != nn) { 108 if (tmp != nn) {
109 lambda[j] ^= 109 lambda[j] ^=
110 alpha_to[rs_modnn(rs, u + tmp)]; 110 alpha_to[rs_modnn(rs, u + tmp)];
111 } 111 }
112 } 112 }
@@ -127,8 +127,8 @@
127 discr_r = 0; 127 discr_r = 0;
128 for (i = 0; i < r; i++) { 128 for (i = 0; i < r; i++) {
129 if ((lambda[i] != 0) && (s[r - i - 1] != nn)) { 129 if ((lambda[i] != 0) && (s[r - i - 1] != nn)) {
130 discr_r ^= 130 discr_r ^=
131 alpha_to[rs_modnn(rs, 131 alpha_to[rs_modnn(rs,
132 index_of[lambda[i]] + 132 index_of[lambda[i]] +
133 s[r - i - 1])]; 133 s[r - i - 1])];
134 } 134 }
@@ -143,7 +143,7 @@
143 t[0] = lambda[0]; 143 t[0] = lambda[0];
144 for (i = 0; i < nroots; i++) { 144 for (i = 0; i < nroots; i++) {
145 if (b[i] != nn) { 145 if (b[i] != nn) {
146 t[i + 1] = lambda[i + 1] ^ 146 t[i + 1] = lambda[i + 1] ^
147 alpha_to[rs_modnn(rs, discr_r + 147 alpha_to[rs_modnn(rs, discr_r +
148 b[i])]; 148 b[i])];
149 } else 149 } else
@@ -229,7 +229,7 @@
229 num1 = 0; 229 num1 = 0;
230 for (i = deg_omega; i >= 0; i--) { 230 for (i = deg_omega; i >= 0; i--) {
231 if (omega[i] != nn) 231 if (omega[i] != nn)
232 num1 ^= alpha_to[rs_modnn(rs, omega[i] + 232 num1 ^= alpha_to[rs_modnn(rs, omega[i] +
233 i * root[j])]; 233 i * root[j])];
234 } 234 }
235 num2 = alpha_to[rs_modnn(rs, root[j] * (fcr - 1) + nn)]; 235 num2 = alpha_to[rs_modnn(rs, root[j] * (fcr - 1) + nn)];
@@ -239,13 +239,13 @@
239 * lambda_pr of lambda[i] */ 239 * lambda_pr of lambda[i] */
240 for (i = min(deg_lambda, nroots - 1) & ~1; i >= 0; i -= 2) { 240 for (i = min(deg_lambda, nroots - 1) & ~1; i >= 0; i -= 2) {
241 if (lambda[i + 1] != nn) { 241 if (lambda[i + 1] != nn) {
242 den ^= alpha_to[rs_modnn(rs, lambda[i + 1] + 242 den ^= alpha_to[rs_modnn(rs, lambda[i + 1] +
243 i * root[j])]; 243 i * root[j])];
244 } 244 }
245 } 245 }
246 /* Apply error to data */ 246 /* Apply error to data */
247 if (num1 != 0 && loc[j] >= pad) { 247 if (num1 != 0 && loc[j] >= pad) {
248 uint16_t cor = alpha_to[rs_modnn(rs,index_of[num1] + 248 uint16_t cor = alpha_to[rs_modnn(rs,index_of[num1] +
249 index_of[num2] + 249 index_of[num2] +
250 nn - index_of[den])]; 250 nn - index_of[den])];
251 /* Store the error correction pattern, if a 251 /* Store the error correction pattern, if a