summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/reed-solomon/char.h2
-rw-r--r--gnuradio-core/src/lib/reed-solomon/decode_rs.c26
-rw-r--r--gnuradio-core/src/lib/reed-solomon/encode_rs.c2
-rw-r--r--gnuradio-core/src/lib/reed-solomon/exercise.c10
-rw-r--r--gnuradio-core/src/lib/reed-solomon/init_rs.c9
5 files changed, 25 insertions, 24 deletions
diff --git a/gnuradio-core/src/lib/reed-solomon/char.h b/gnuradio-core/src/lib/reed-solomon/char.h
index 8010fb0b9..762e9e295 100644
--- a/gnuradio-core/src/lib/reed-solomon/char.h
+++ b/gnuradio-core/src/lib/reed-solomon/char.h
@@ -21,7 +21,7 @@ struct rs {
unsigned char iprim; /* prim-th root of 1, index form */
};
-static inline int modnn(struct rs *rs,int x){
+static inline unsigned int modnn(struct rs *rs, unsigned int x){
while (x >= rs->nn) {
x -= rs->nn;
x = (x >> rs->mm) + (x & rs->nn);
diff --git a/gnuradio-core/src/lib/reed-solomon/decode_rs.c b/gnuradio-core/src/lib/reed-solomon/decode_rs.c
index ba60b89ee..4b7d27cec 100644
--- a/gnuradio-core/src/lib/reed-solomon/decode_rs.c
+++ b/gnuradio-core/src/lib/reed-solomon/decode_rs.c
@@ -30,7 +30,7 @@ DTYPE *data, int *eras_pos, int no_eras){
struct rs *rs = (struct rs *)p;
#endif
int deg_lambda, el, deg_omega;
- int i, j, r,k;
+ int i, j, r, k;
#ifdef MAX_ARRAY
DTYPE u,q,tmp,num1,num2,den,discr_r;
DTYPE lambda[MAX_ARRAY], s[MAX_ARRAY]; /* Err+Eras Locator poly
@@ -47,11 +47,11 @@ DTYPE *data, int *eras_pos, int no_eras){
int syn_error, count;
/* form the syndromes; i.e., evaluate data(x) at roots of g(x) */
- for(i=0;i<NROOTS;i++)
+ for(i=0;(unsigned int)i<NROOTS;i++)
s[i] = data[0];
- for(j=1;j<NN;j++){
- for(i=0;i<NROOTS;i++){
+ for(j=1;(unsigned int)j<NN;j++){
+ for(i=0;(unsigned int)i<NROOTS;i++){
if(s[i] == 0){
s[i] = data[j];
} else {
@@ -62,7 +62,7 @@ DTYPE *data, int *eras_pos, int no_eras){
/* Convert syndromes to index form, checking for nonzero condition */
syn_error = 0;
- for(i=0;i<NROOTS;i++){
+ for(i=0;(unsigned int)i<NROOTS;i++){
syn_error |= s[i];
s[i] = INDEX_OF[s[i]];
}
@@ -125,7 +125,7 @@ DTYPE *data, int *eras_pos, int no_eras){
#endif
#endif
}
- for(i=0;i<NROOTS+1;i++)
+ for(i=0;(unsigned int)i<NROOTS+1;i++)
b[i] = INDEX_OF[lambda[i]];
/*
@@ -134,7 +134,7 @@ DTYPE *data, int *eras_pos, int no_eras){
*/
r = no_eras;
el = no_eras;
- while (++r <= NROOTS) { /* r is the step number */
+ while ((unsigned int)(++r) <= NROOTS) { /* r is the step number */
/* Compute discrepancy at the r-th step in poly-form */
discr_r = 0;
for (i = 0; i < r; i++){
@@ -150,7 +150,7 @@ DTYPE *data, int *eras_pos, int no_eras){
} else {
/* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */
t[0] = lambda[0];
- for (i = 0 ; i < NROOTS; i++) {
+ for (i = 0 ; (unsigned int)i < NROOTS; i++) {
if(b[i] != A0)
t[i+1] = lambda[i+1] ^ ALPHA_TO[MODNN(discr_r + b[i])];
else
@@ -162,7 +162,7 @@ DTYPE *data, int *eras_pos, int no_eras){
* 2 lines below: B(x) <-- inv(discr_r) *
* lambda(x)
*/
- for (i = 0; i <= NROOTS; i++)
+ for (i = 0; (unsigned int)i <= NROOTS; i++)
b[i] = (lambda[i] == 0) ? A0 : MODNN(INDEX_OF[lambda[i]] - discr_r + NN);
} else {
/* 2 lines below: B(x) <-- x*B(x) */
@@ -175,7 +175,7 @@ DTYPE *data, int *eras_pos, int no_eras){
/* Convert lambda to index form and compute deg(lambda(x)) */
deg_lambda = 0;
- for(i=0;i<NROOTS+1;i++){
+ for(i=0;(unsigned int)i<NROOTS+1;i++){
lambda[i] = INDEX_OF[lambda[i]];
if(lambda[i] != A0)
deg_lambda = i;
@@ -183,7 +183,7 @@ DTYPE *data, int *eras_pos, int no_eras){
/* Find roots of the error+erasure locator polynomial by Chien search */
memcpy(&reg[1],&lambda[1],NROOTS*sizeof(reg[0]));
count = 0; /* Number of roots of lambda(x) */
- for (i = 1,k=IPRIM-1; i <= NN; i++,k = MODNN(k+IPRIM)) {
+ for (i = 1,k=IPRIM-1; (unsigned int)i <= NN; i++,k = MODNN(k+IPRIM)) {
q = 1; /* lambda[0] is always 0 */
for (j = deg_lambda; j > 0; j--){
if (reg[j] != A0) {
@@ -218,7 +218,7 @@ DTYPE *data, int *eras_pos, int no_eras){
* x**NROOTS). in index form. Also find deg(omega).
*/
deg_omega = 0;
- for (i = 0; i < NROOTS;i++){
+ for (i = 0; (unsigned int)i < NROOTS;i++){
tmp = 0;
j = (deg_lambda < i) ? deg_lambda : i;
for(;j >= 0; j--){
@@ -245,7 +245,7 @@ DTYPE *data, int *eras_pos, int no_eras){
den = 0;
/* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
- for (i = min(deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) {
+ for (i = (int)min((unsigned int)deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) {
if(lambda[i+1] != A0)
den ^= ALPHA_TO[MODNN(lambda[i+1] + i * root[j])];
}
diff --git a/gnuradio-core/src/lib/reed-solomon/encode_rs.c b/gnuradio-core/src/lib/reed-solomon/encode_rs.c
index 9d56d0bf1..cd31f32c6 100644
--- a/gnuradio-core/src/lib/reed-solomon/encode_rs.c
+++ b/gnuradio-core/src/lib/reed-solomon/encode_rs.c
@@ -20,7 +20,7 @@ DTYPE *data, DTYPE *bb){
#ifndef FIXED
struct rs *rs = (struct rs *)p;
#endif
- int i, j;
+ unsigned int i, j;
DTYPE feedback;
memset(bb,0,NROOTS*sizeof(DTYPE));
diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gnuradio-core/src/lib/reed-solomon/exercise.c
index 987fe1aeb..be3d3bd13 100644
--- a/gnuradio-core/src/lib/reed-solomon/exercise.c
+++ b/gnuradio-core/src/lib/reed-solomon/exercise.c
@@ -48,13 +48,13 @@ int trials){
#endif
#if MAX_ARRAY
DTYPE block[MAX_ARRAY],tblock[MAX_ARRAY];
- int i;
+ unsigned int i;
int errors;
int errlocs[MAX_ARRAY];
int derrlocs[MAX_ARRAY];
#else
DTYPE block[NN],tblock[NN];
- int i;
+ unsigned int i;
int errors;
int errlocs[NN];
int derrlocs[NROOTS];
@@ -66,7 +66,7 @@ int trials){
while(trials-- != 0){
/* Test up to the error correction capacity of the code */
- for(errors=0;errors <= NROOTS/2;errors++){
+ for(errors=0;(unsigned int)errors <= NROOTS/2;errors++){
/* Load block with random data and encode */
for(i=0;i<NN-NROOTS;i++)
@@ -83,7 +83,7 @@ int trials){
memset(errlocs,0,sizeof(errlocs));
memset(derrlocs,0,sizeof(derrlocs));
erasures=0;
- for(i=0;i<errors;i++){
+ for(i=0;i<(unsigned int)errors;i++){
do {
errval = random() & NN;
} while(errval == 0); /* Error value must be nonzero */
@@ -113,7 +113,7 @@ int trials){
printf(" decoder says %d errors, true number is %d\n",derrors,errors);
decoder_errors++;
}
- for(i=0;i<derrors;i++){
+ for(i=0;i<(unsigned int)derrors;i++){
if(errlocs[derrlocs[i]] == 0){
PRINTPARM
printf(" decoder indicates error in location %d without error\n",i);
diff --git a/gnuradio-core/src/lib/reed-solomon/init_rs.c b/gnuradio-core/src/lib/reed-solomon/init_rs.c
index 11d7c8170..4ec77cd72 100644
--- a/gnuradio-core/src/lib/reed-solomon/init_rs.c
+++ b/gnuradio-core/src/lib/reed-solomon/init_rs.c
@@ -34,16 +34,17 @@ void FREE_RS(void *p){
void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned fcr,unsigned prim,
unsigned int nroots){
struct rs *rs;
- int i, j, sr,root,iprim;
+ int sr,root,iprim;
+ unsigned int i, j;
if(symsize > 8*sizeof(DTYPE))
return NULL; /* Need version with ints rather than chars */
- if(fcr >= (1<<symsize))
+ if(fcr >= (1u<<symsize))
return NULL;
- if(prim == 0 || prim >= (1<<symsize))
+ if(prim == 0 || prim >= (1u<<symsize))
return NULL;
- if(nroots >= (1<<symsize))
+ if(nroots >= (1u<<symsize))
return NULL; /* Can't have more roots than symbol values! */
rs = (struct rs *)calloc(1,sizeof(struct rs));