Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Small improvement of FX.25 RS encoder speed
The old design walked the entire feedback array XORing all values, then
shifted them all down by one index. This design does the shift-by-one
while doing the XOR work to save a step.

Signed-off-by: Justin Brzozoski <justin.brzozoski@gmail.com>
  • Loading branch information
jbrzozoski committed Jun 10, 2020
commit e3f834f26170cfd67ad0804e56e1044fca8e26bd
12 changes: 6 additions & 6 deletions src/fx25_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ void ENCODE_RS(struct rs * restrict rs, DTYPE * restrict data, DTYPE * restrict
for(i=0;i<NN-NROOTS;i++){
feedback = INDEX_OF[data[i] ^ bb[0]];
if(feedback != A0){ /* feedback term is non-zero */
/* Shift and XOR */
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[j-1] = bb[j] ^ ALPHA_TO[MODNN(feedback + GENPOLY[NROOTS-j])];
bb[NROOTS-1] = ALPHA_TO[MODNN(feedback + GENPOLY[0])];
else
} else{
/* Shift only */
memmove(&bb[0],&bb[1],sizeof(DTYPE)*(NROOTS-1));
bb[NROOTS-1] = 0;
}
}
}

Expand Down