diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
| commit | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (patch) | |
| tree | fbfdfe6bcb0a8a114be2480dac53d88c977e4869 /lib/encode_rs.c | |
| parent | 4320ce238aae1fe87fc9f379cdd816e9317885fa (diff) | |
New upstream version 2.7.0~rc8+repackupstream/2.7.0_rc8+repack
Diffstat (limited to 'lib/encode_rs.c')
| -rwxr-xr-x | lib/encode_rs.c | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/lib/encode_rs.c b/lib/encode_rs.c index 26b81c46..9d56d0bf 100755 --- a/lib/encode_rs.c +++ b/lib/encode_rs.c @@ -1,47 +1,47 @@ -/* Reed-Solomon encoder
- * Copyright 2002, Phil Karn, KA9Q
- * May be used under the terms of the GNU General Public License (GPL)
- */
-#include <string.h>
-
-#ifdef FIXED
-#include "fixed.h"
-#elif defined(BIGSYM)
-#include "int.h"
-#else
-#include "char.h"
-#endif
-
-void ENCODE_RS(
-#ifndef FIXED
-void *p,
-#endif
-DTYPE *data, DTYPE *bb){
-#ifndef FIXED
- struct rs *rs = (struct rs *)p;
-#endif
- int i, j;
- DTYPE feedback;
-
- memset(bb,0,NROOTS*sizeof(DTYPE));
-
- for(i=0;i<NN-NROOTS;i++){
- feedback = INDEX_OF[data[i] ^ bb[0]];
- if(feedback != A0){ /* feedback term is non-zero */
-#ifdef UNNORMALIZED
- /* This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
- * always be for the polynomials constructed by init_rs()
- */
- feedback = MODNN(NN - GENPOLY[NROOTS] + feedback);
-#endif
- for(j=1;j<NROOTS;j++)
- bb[j] ^= ALPHA_TO[MODNN(feedback + GENPOLY[NROOTS-j])];
- }
- /* Shift */
- memmove(&bb[0],&bb[1],sizeof(DTYPE)*(NROOTS-1));
- if(feedback != A0)
- bb[NROOTS-1] = ALPHA_TO[MODNN(feedback + GENPOLY[0])];
- else
- bb[NROOTS-1] = 0;
- }
-}
+/* Reed-Solomon encoder + * Copyright 2002, Phil Karn, KA9Q + * May be used under the terms of the GNU General Public License (GPL) + */ +#include <string.h> + +#ifdef FIXED +#include "fixed.h" +#elif defined(BIGSYM) +#include "int.h" +#else +#include "char.h" +#endif + +void ENCODE_RS( +#ifndef FIXED +void *p, +#endif +DTYPE *data, DTYPE *bb){ +#ifndef FIXED + struct rs *rs = (struct rs *)p; +#endif + int i, j; + DTYPE feedback; + + memset(bb,0,NROOTS*sizeof(DTYPE)); + + for(i=0;i<NN-NROOTS;i++){ + feedback = INDEX_OF[data[i] ^ bb[0]]; + if(feedback != A0){ /* feedback term is non-zero */ +#ifdef UNNORMALIZED + /* This line is unnecessary when GENPOLY[NROOTS] is unity, as it must + * always be for the polynomials constructed by init_rs() + */ + feedback = MODNN(NN - GENPOLY[NROOTS] + feedback); +#endif + for(j=1;j<NROOTS;j++) + bb[j] ^= ALPHA_TO[MODNN(feedback + GENPOLY[NROOTS-j])]; + } + /* Shift */ + memmove(&bb[0],&bb[1],sizeof(DTYPE)*(NROOTS-1)); + if(feedback != A0) + bb[NROOTS-1] = ALPHA_TO[MODNN(feedback + GENPOLY[0])]; + else + bb[NROOTS-1] = 0; + } +} |
