rs-common.h
Go to the documentation of this file.
/* Stuff common to all the general-purpose Reed-Solomon codecs
* Copyright 2004 Phil Karn, KA9Q
* May be used under the terms of the GNU Lesser General Public License (LGPL)
*/
/* Reed-Solomon codec control block */
struct rs {
int mm; /* Bits per symbol */
int nn; /* Symbols per block (= (1<<mm)-1) */
data_t *alpha_to; /* log lookup table */
data_t *index_of; /* Antilog lookup table */
data_t *genpoly; /* Generator polynomial */
int nroots; /* Number of generator roots = number of parity symbols */
int fcr; /* First consecutive root, index form */
int prim; /* Primitive element, index form */
int iprim; /* prim-th root of 1, index form */
int pad; /* Padding bytes in shortened block */
};
static inline int modnn(struct rs *rs,int x){
while (x >= rs->nn) {
x -= rs->nn;
x = (x >> rs->mm) + (x & rs->nn);
}
return x;
}
data_t
unsigned char data_t
Definition char.h:6
modnn
static int modnn(struct rs *rs, int x)
Definition rs-common.h:20
rs
Definition rs-common.h:7
rs::nn
int nn
Definition rs-common.h:9
rs::nroots
int nroots
Definition rs-common.h:13
rs::iprim
int iprim
Definition rs-common.h:16
rs::genpoly
data_t * genpoly
Definition rs-common.h:12
rs::index_of
data_t * index_of
Definition rs-common.h:11
rs::fcr
int fcr
Definition rs-common.h:14
rs::mm
int mm
Definition rs-common.h:8
rs::pad
int pad
Definition rs-common.h:17
rs::prim
int prim
Definition rs-common.h:15
rs::alpha_to
data_t * alpha_to
Definition rs-common.h:10