31 #error "NROOTS not defined" 35 #error "NN not defined" 39 #error "PAD not defined" 42 #if !defined(ALPHA_TO) 43 #error "ALPHA_TO not defined" 46 #if !defined(INDEX_OF) 47 #error "INDEX_OF not defined" 51 #error "MODNN not defined" 55 #error "FCR not defined" 59 #error "PRIM not defined" 63 #define NULL ((void *)0) 67 #define MIN(a,b) ((a) < (b) ? (a) : (b)) 109 memset(&lambda[1],0,NROOTS*
sizeof(lambda[0]));
115 for (i = 1; i < no_eras; i++) {
117 for (j = i+1; j > 0; j--) {
129 for(i=1;i<=no_eras;i++)
135 for (j = 1; j <= no_eras; j++)
137 reg[
j] =
MODNN(reg[j] + j);
147 if (count != no_eras) {
148 fprintf(stderr,
"count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras);
153 fprintf(stderr,
"\n Erasure positions as determined by roots of Eras Loc Poly:\n");
154 for (i = 0; i <
count; i++)
155 fprintf(stderr,
"%d ", loc[i]);
156 fprintf(stderr,
"\n");
160 for(i=0;i<NROOTS+1;i++)
169 while (++r <= NROOTS) {
172 for (i = 0; i <
r; i++){
173 if ((lambda[i] != 0) && (s[r-i-1] !=
A0)) {
180 memmove(&b[1],b,NROOTS*
sizeof(b[0]));
185 for (i = 0 ; i <
NROOTS; i++) {
189 t[i+1] = lambda[i+1];
191 if (2 * el <= r + no_eras - 1) {
192 el = r + no_eras -
el;
197 for (i = 0; i <=
NROOTS; i++)
201 memmove(&b[1],b,NROOTS*
sizeof(b[0]));
204 memcpy(lambda,t,(NROOTS+1)*
sizeof(t[0]));
210 for(i=0;i<NROOTS+1;i++){
216 memcpy(®[1],&lambda[1],NROOTS*
sizeof(reg[0]));
220 for (j = deg_lambda; j > 0; j--){
222 reg[
j] =
MODNN(reg[j] + j);
230 fprintf(stderr,
"count %d root %d loc %d\n",count,i,k);
237 if(++count == deg_lambda)
240 if (deg_lambda != count) {
252 deg_omega = deg_lambda-1;
255 for(j=i;j >= 0; j--){
256 if ((s[i - j] !=
A0) && (lambda[j] !=
A0))
266 for (j = count-1; j >=0; j--) {
268 for (i = deg_omega; i >= 0; i--) {
276 for (i =
MIN(deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) {
277 if(lambda[i+1] !=
A0)
282 fprintf(stderr,
"\n ERROR: denominator = 0\n");
288 if (num1 != 0 && loc[j] >= PAD) {
293 if(eras_pos !=
NULL){
295 eras_pos[i] = loc[i];
int r
Definition: decode_rs.h:71
data_t t[NROOTS+1]
Definition: decode_rs.h:77
int i
Definition: decode_rs.h:71
int j
Definition: decode_rs.h:71
data_t num2
Definition: decode_rs.h:74
int count
Definition: decode_rs.h:79
data_t q
Definition: decode_rs.h:74
data_t root[NROOTS]
Definition: decode_rs.h:78
#define PAD
Definition: char.h:19
data_t lambda[NROOTS+1]
Definition: decode_rs.h:75
#define NULL
Definition: decode_rs.h:63
#define NN
Definition: char.h:11
deg_lambda
Definition: decode_rs.h:209
#define FCR
Definition: char.h:16
#define INDEX_OF
Definition: char.h:13
data_t omega[NROOTS+1]
Definition: decode_rs.h:77
data_t discr_r
Definition: decode_rs.h:74
data_t reg[NROOTS+1]
Definition: decode_rs.h:78
data_t tmp
Definition: decode_rs.h:74
data_t b[NROOTS+1]
Definition: decode_rs.h:77
#define ALPHA_TO
Definition: char.h:12
#define A0
Definition: decode_rs.h:69
#define MIN(a, b)
Definition: decode_rs.h:67
deg_omega
Definition: decode_rs.h:252
data_t loc[NROOTS]
Definition: decode_rs.h:78
#define MODNN(x)
Definition: char.h:8
unsigned char data_t
Definition: char.h:6
data_t den
Definition: decode_rs.h:74
data_t num1
Definition: decode_rs.h:74
#define IPRIM
Definition: char.h:18
#define PRIM
Definition: char.h:17
data_t u
Definition: decode_rs.h:74
#define NROOTS
Definition: char.h:15
int k
Definition: decode_rs.h:71
data_t s[NROOTS]
Definition: decode_rs.h:75
int syn_error
Definition: decode_rs.h:79
el
Definition: decode_rs.h:168