diff --git a/ecc/bch_ecc.c b/ecc/bch_ecc.c index e16798c..fff6679 100644 --- a/ecc/bch_ecc.c +++ b/ecc/bch_ecc.c @@ -846,7 +846,7 @@ int rs_encode(ui8_t cw[]) { for (j = RS.R; j < RS.N; j++) __cw[j] = cw[j]; poly_divmod(__cw, RS.g, d, parity); //if (poly_deg(parity) >= RS.R) return -1; - for (j = 0; j <= poly_deg(parity); j++) cw[j] = parity[j]; + for (j = 0; j < RS.R; j++) cw[j] = parity[j]; return 0; } diff --git a/ecc/ecc-rs_gf16.c b/ecc/ecc-rs_gf16.c index b61bf5d..f99de0c 100644 --- a/ecc/ecc-rs_gf16.c +++ b/ecc/ecc-rs_gf16.c @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) { for (i = 0; i < errors; i++) printf(" %d", errpos[i]); printf("\n"); } - for (i = 0; i < rs_N; i++) printf("%1X", codeword[i]); printf("\n"); + for (i = 0; i < rs_N; i++) printf("%1x", codeword[i]); printf("\n"); #endif } else { @@ -218,9 +218,9 @@ RS(15,9): message length 9 parity length 6 -./ecc-rs15 str1 [str2] - str1: 9 nibbles (msg) - str2: 6 nibbles (par) +./ecc-rs15 msg [par] + msg: 9 nibbles + par: 6 nibbles ecc-rs15 input/output: nibbles cw[]: 1 byte / 1 nibble @@ -228,7 +228,7 @@ cw[]: 1 byte / 1 nibble examples: -$./ecc-rs15 000000001 +$ ./ecc-rs15 000000001 msg: 000000001 @@ -243,8 +243,7 @@ parity : 1af243 codeword: 1000000001af243 - -$./ecc-rs15 000000001 342FA1 +$ ./ecc-rs15 000000001 342FA1 msg: 000000001 par: 342FA1 @@ -255,7 +254,7 @@ errs: 0 codeword errors: 0 -1000000001AF243 +1000000001af243 */