Skip to content

Commit

Permalink
[LIB] reed_solomon: Clean up trailing white spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
KAGA-KOKO authored and Thomas Gleixner committed Nov 7, 2005
1 parent 182ec4e commit 03ead84
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 72 deletions.
28 changes: 14 additions & 14 deletions include/linux/rslib.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
/*
* include/linux/rslib.h
*
* Overview:
* Generic Reed Solomon encoder / decoder library
*
*
* Copyright (C) 2004 Thomas Gleixner ([email protected])
*
* RS code lifted from reed solomon library written by Phil Karn
* Copyright 2002 Phil Karn, KA9Q
*
* $Id: rslib.h,v 1.3 2004/10/05 22:08:22 gleixner Exp $
* $Id: rslib.h,v 1.4 2005/11/07 11:14:52 gleixner Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand All @@ -21,20 +21,20 @@

#include <linux/list.h>

/**
/**
* struct rs_control - rs control structure
*
*
* @mm: Bits per symbol
* @nn: Symbols per block (= (1<<mm)-1)
* @alpha_to: log lookup table
* @index_of: Antilog lookup table
* @genpoly: Generator polynomial
* @genpoly: Generator polynomial
* @nroots: Number of generator roots = number of parity symbols
* @fcr: First consecutive root, index form
* @prim: Primitive element, index form
* @iprim: prim-th root of 1, index form
* @gfpoly: The primitive generator polynominal
* @users: Users of this structure
* @prim: Primitive element, index form
* @iprim: prim-th root of 1, index form
* @gfpoly: The primitive generator polynominal
* @users: Users of this structure
* @list: List entry for the rs control list
*/
struct rs_control {
Expand All @@ -58,7 +58,7 @@ int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par,
uint16_t invmsk);
#endif
#ifdef CONFIG_REED_SOLOMON_DEC8
int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len,
int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len,
uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk,
uint16_t *corr);
#endif
Expand All @@ -75,7 +75,7 @@ int decode_rs16(struct rs_control *rs, uint16_t *data, uint16_t *par, int len,
#endif

/* Create or get a matching rs control structure */
struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim,
struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim,
int nroots);

/* Release a rs control structure */
Expand All @@ -87,9 +87,9 @@ void free_rs(struct rs_control *rs);
* @x: the value to reduce
*
* where
* rs->mm = number of bits per symbol
* rs->mm = number of bits per symbol
* rs->nn = (2^rs->mm) - 1
*
*
* Simple arithmetic modulo would return a wrong result for values
* >= 3 * rs->nn
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/reed_solomon/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This is a modified version of reed solomon lib,
# This is a modified version of reed solomon lib,
#

obj-$(CONFIG_REED_SOLOMON) += reed_solomon.o
Expand Down
36 changes: 18 additions & 18 deletions lib/reed_solomon/decode_rs.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/*
/*
* lib/reed_solomon/decode_rs.c
*
* Overview:
* Generic Reed Solomon encoder / decoder library
*
*
* Copyright 2002, Phil Karn, KA9Q
* May be used under the terms of the GNU General Public License (GPL)
*
* Adaption to the kernel by Thomas Gleixner ([email protected])
*
* $Id: decode_rs.c,v 1.6 2004/10/22 15:41:47 gleixner Exp $
* $Id: decode_rs.c,v 1.7 2005/11/07 11:14:59 gleixner Exp $
*
*/

/* Generic data width independent code which is included by the
/* Generic data width independent code which is included by the
* wrappers.
*/
{
{
int deg_lambda, el, deg_omega;
int i, j, r, k, pad;
int nn = rs->nn;
Expand All @@ -41,9 +41,9 @@
pad = nn - nroots - len;
if (pad < 0 || pad >= nn)
return -ERANGE;

/* Does the caller provide the syndrome ? */
if (s != NULL)
if (s != NULL)
goto decode;

/* form the syndromes; i.e., evaluate data(x) at roots of
Expand All @@ -54,11 +54,11 @@
for (j = 1; j < len; j++) {
for (i = 0; i < nroots; i++) {
if (syn[i] == 0) {
syn[i] = (((uint16_t) data[j]) ^
syn[i] = (((uint16_t) data[j]) ^
invmsk) & msk;
} else {
syn[i] = ((((uint16_t) data[j]) ^
invmsk) & msk) ^
invmsk) & msk) ^
alpha_to[rs_modnn(rs, index_of[syn[i]] +
(fcr + i) * prim)];
}
Expand All @@ -70,7 +70,7 @@
if (syn[i] == 0) {
syn[i] = ((uint16_t) par[j]) & msk;
} else {
syn[i] = (((uint16_t) par[j]) & msk) ^
syn[i] = (((uint16_t) par[j]) & msk) ^
alpha_to[rs_modnn(rs, index_of[syn[i]] +
(fcr+i)*prim)];
}
Expand Down Expand Up @@ -99,14 +99,14 @@

if (no_eras > 0) {
/* Init lambda to be the erasure locator polynomial */
lambda[1] = alpha_to[rs_modnn(rs,
lambda[1] = alpha_to[rs_modnn(rs,
prim * (nn - 1 - eras_pos[0]))];
for (i = 1; i < no_eras; i++) {
u = rs_modnn(rs, prim * (nn - 1 - eras_pos[i]));
for (j = i + 1; j > 0; j--) {
tmp = index_of[lambda[j - 1]];
if (tmp != nn) {
lambda[j] ^=
lambda[j] ^=
alpha_to[rs_modnn(rs, u + tmp)];
}
}
Expand All @@ -127,8 +127,8 @@
discr_r = 0;
for (i = 0; i < r; i++) {
if ((lambda[i] != 0) && (s[r - i - 1] != nn)) {
discr_r ^=
alpha_to[rs_modnn(rs,
discr_r ^=
alpha_to[rs_modnn(rs,
index_of[lambda[i]] +
s[r - i - 1])];
}
Expand All @@ -143,7 +143,7 @@
t[0] = lambda[0];
for (i = 0; i < nroots; i++) {
if (b[i] != nn) {
t[i + 1] = lambda[i + 1] ^
t[i + 1] = lambda[i + 1] ^
alpha_to[rs_modnn(rs, discr_r +
b[i])];
} else
Expand Down Expand Up @@ -229,7 +229,7 @@
num1 = 0;
for (i = deg_omega; i >= 0; i--) {
if (omega[i] != nn)
num1 ^= alpha_to[rs_modnn(rs, omega[i] +
num1 ^= alpha_to[rs_modnn(rs, omega[i] +
i * root[j])];
}
num2 = alpha_to[rs_modnn(rs, root[j] * (fcr - 1) + nn)];
Expand All @@ -239,13 +239,13 @@
* lambda_pr of lambda[i] */
for (i = min(deg_lambda, nroots - 1) & ~1; i >= 0; i -= 2) {
if (lambda[i + 1] != nn) {
den ^= alpha_to[rs_modnn(rs, lambda[i + 1] +
den ^= alpha_to[rs_modnn(rs, lambda[i + 1] +
i * root[j])];
}
}
/* Apply error to data */
if (num1 != 0 && loc[j] >= pad) {
uint16_t cor = alpha_to[rs_modnn(rs,index_of[num1] +
uint16_t cor = alpha_to[rs_modnn(rs,index_of[num1] +
index_of[num2] +
nn - index_of[den])];
/* Store the error correction pattern, if a
Expand Down
14 changes: 7 additions & 7 deletions lib/reed_solomon/encode_rs.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
/*
* lib/reed_solomon/encode_rs.c
*
* Overview:
* Generic Reed Solomon encoder / decoder library
*
*
* Copyright 2002, Phil Karn, KA9Q
* May be used under the terms of the GNU General Public License (GPL)
*
* Adaption to the kernel by Thomas Gleixner ([email protected])
*
* $Id: encode_rs.c,v 1.4 2004/10/22 15:41:47 gleixner Exp $
* $Id: encode_rs.c,v 1.5 2005/11/07 11:14:59 gleixner Exp $
*
*/

/* Generic data width independent code which is included by the
/* Generic data width independent code which is included by the
* wrappers.
* int encode_rsX (struct rs_control *rs, uintX_t *data, int len, uintY_t *par)
*/
Expand All @@ -35,16 +35,16 @@
for (i = 0; i < len; i++) {
fb = index_of[((((uint16_t) data[i])^invmsk) & msk) ^ par[0]];
/* feedback term is non-zero */
if (fb != nn) {
if (fb != nn) {
for (j = 1; j < nroots; j++) {
par[j] ^= alpha_to[rs_modnn(rs, fb +
par[j] ^= alpha_to[rs_modnn(rs, fb +
genpoly[nroots - j])];
}
}
/* Shift */
memmove(&par[0], &par[1], sizeof(uint16_t) * (nroots - 1));
if (fb != nn) {
par[nroots - 1] = alpha_to[rs_modnn(rs,
par[nroots - 1] = alpha_to[rs_modnn(rs,
fb + genpoly[0])];
} else {
par[nroots - 1] = 0;
Expand Down
Loading

0 comments on commit 03ead84

Please sign in to comment.