File tree Expand file tree Collapse file tree 1 file changed +22
-12
lines changed
Expand file tree Collapse file tree 1 file changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -760,28 +760,38 @@ begin
760760 %
761761 % Generate the coefficients
762762 %
763+ % This is >90% of runtime for large synbols
764+ %
763765 /coeffs [ 1 rsnc {0} repeat ] def
764- 1 1 rsnc {
765- /i exch def
766- coeffs i coeffs i 1 sub get put
767- i 1 sub -1 1 {
768- /j exch def
769- coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod xor put
766+ 1 1 rsnc { % i
767+ coeffs 1 index 2 copy 1 sub get put % coeffs[i] = coeffs[i-1]
768+ rsalog 1 index get % ai = rsalog[i]
769+ exch 1 sub -1 1 { % for j in i-1 -> 1
770+ coeffs exch 2 copy get % ... coeffs j coeffs[j]
771+ 3 index % ... ai
772+ rsprod % p = coeffs[j] * ai
773+ coeffs 2 index 1 sub get % ... coeffs[j-1]
774+ xor put % coeffs[j] = p ^ coeffs[j-1]
770775 } for
771- coeffs 0 coeffs 0 get rsalog i get rsprod put
776+ coeffs 0 2 copy get 3 index rsprod put % coeffs[0] = coeffs[0] * ai
777+ pop % ai
772778 } for
773779
774780 %
775781 % Extend the input with the error correction values
776782 %
777783 /nd rscws length def
778784 /rscws [ rscws aload pop rsnc {0} repeat 0 ] def
779- 0 1 nd 1 sub {
780- /k exch rscws exch get rscws nd get xor def
781- 0 1 rsnc 1 sub {
782- /j exch def
783- rscws nd j add rscws nd j add 1 add get k coeffs rsnc j sub 1 sub get rsprod xor put
785+ 0 1 nd 1 sub { % i
786+ rscws exch get rscws nd get xor % k = rscws[i] ^ rscw[nd]
787+ 0 1 rsnc 1 sub { % j
788+ dup
789+ rscws exch nd add 2 copy 1 add get % ... rscws nd+j rscws[nd+j+1]
790+ coeffs rsnc 6 -1 roll sub 1 sub get % ... coeffs[rsnc-1-j]
791+ 4 index % ... k
792+ rsprod xor put % rscws[nd+j] = rscws[nd+j+1] ^ (coeffs[rsnc-1-j] * k)
784793 } for
794+ pop % k
785795 } for
786796
787797 %
You can’t perform that action at this time.
0 commit comments