template<typename T, int N, int NP, int DP, typename TGF, int GFTRUNCGEN>
struct leansdr::bch_engine< T, N, NP, DP, TGF, GFTRUNCGEN >
Definition at line 42 of file bch.h.
template<typename T , int N, int NP, int DP, typename TGF , int GFTRUNCGEN>
Implements leansdr::bch_interface.
Definition at line 85 of file bch.h.
References leansdr::divmod(), and i.
88 bool corrupted =
false;
91 bitvect<T, DP> *rem =
new bitvect<T, DP>[
npolys];
92 for (
int j = 0; j <
npolys; ++j)
97 TGF *S =
new TGF[2 *
npolys];
115 fprintf(stderr,
"synd:");
116 for (
int i=0;
i<2*
npolys; ++
i ) fprintf(stderr,
" %04x", S[
i]);
117 fprintf(stderr,
"\n");
129 TGF *C =
new TGF[NN];
131 TGF *B =
new TGF[NN];
141 for (
int n = 0; n < NN; ++n)
144 for (
int i = 1; i <= L; ++
i)
153 TGF *tmp =
new TGF[NN];
154 memcpy(tmp, C,
sizeof(tmp));
155 for (
int i = 0; i < NN - m; ++
i)
156 C[m + i] =
GF.
sub(C[m + i],
GF.
mul(d_div_b, B[i]));
158 memcpy(B, tmp,
sizeof(B));
165 for (
int i = 0; i < NN - m; ++
i)
166 C[m + i] =
GF.
sub(C[m + i],
GF.
mul(d_div_b, B[i]));
175 fprintf(stderr,
"C[%d]=", L);
176 for (
int i=0; i<NN; ++
i ) fprintf(stderr,
" %04x", C[i]);
177 fprintf(stderr,
"\n");
187 for (
int i = 0; i < (1 << DP) - 1; ++
i)
194 int loc = (i ? (1 << DP) - 1 - i : 0);
196 int rloc = cwbytes * 8 - 1 - loc;
206 cw[rloc / 8] ^= 128 >> (rloc & 7);
208 if (roots_found == L)
218 if (roots_found != L)
bitvect< T, DP > * truncpolys
bitvect< T, N > divmod(const Tm *m, size_t nm, const bitvect< T, N > &p)
gf2n< TGF, DP, 2, GFTRUNCGEN > GF
TGF eval_poly(const bitvect< T, DP > &poly, bool is_trunc, int rootexp)
template<typename T , int N, int NP, int DP, typename TGF , int GFTRUNCGEN>