41 pad = nn - nroots - len;
42 BUG_ON(pad < 0 || pad >= nn);
50 for (i = 0; i <
nroots; i++)
53 for (j = 1; j <
len; j++) {
54 for (i = 0; i <
nroots; i++) {
61 alpha_to[rs_modnn(
rs, index_of[syn[i]] +
68 for (i = 0; i <
nroots; i++) {
73 alpha_to[rs_modnn(
rs, index_of[syn[i]] +
82 for (i = 0; i <
nroots; i++) {
84 s[
i] = index_of[
s[
i]];
96 memset(&lambda[1], 0, nroots *
sizeof(lambda[0]));
101 lambda[1] = alpha_to[rs_modnn(
rs,
102 prim * (nn - 1 - eras_pos[0]))];
103 for (i = 1; i < no_eras; i++) {
104 u = rs_modnn(
rs, prim * (nn - 1 - eras_pos[i]));
105 for (j = i + 1; j > 0; j--) {
106 tmp = index_of[lambda[j - 1]];
109 alpha_to[rs_modnn(
rs, u + tmp)];
115 for (i = 0; i < nroots + 1; i++)
116 b[i] = index_of[lambda[i]];
124 while (++r <= nroots) {
127 for (i = 0; i <
r; i++) {
128 if ((lambda[i] != 0) && (
s[r - i - 1] != nn)) {
130 alpha_to[rs_modnn(rs,
131 index_of[lambda[i]] +
138 memmove (&b[1], b, nroots *
sizeof (b[0]));
143 for (i = 0; i <
nroots; i++) {
145 t[i + 1] = lambda[i + 1] ^
146 alpha_to[rs_modnn(rs, discr_r +
149 t[i + 1] = lambda[i + 1];
151 if (2 * el <= r + no_eras - 1) {
152 el = r + no_eras -
el;
157 for (i = 0; i <=
nroots; i++) {
158 b[
i] = (lambda[
i] == 0) ? nn :
159 rs_modnn(rs, index_of[lambda[i]]
164 memmove(&b[1], b, nroots *
sizeof(b[0]));
167 memcpy(lambda, t, (nroots + 1) *
sizeof(t[0]));
173 for (i = 0; i < nroots + 1; i++) {
174 lambda[
i] = index_of[lambda[
i]];
179 memcpy(®[1], &lambda[1], nroots *
sizeof(reg[0]));
181 for (i = 1, k = iprim - 1; i <=
nn; i++, k = rs_modnn(rs, k + iprim)) {
183 for (j = deg_lambda; j > 0; j--) {
185 reg[
j] = rs_modnn(
rs, reg[j] + j);
186 q ^= alpha_to[reg[
j]];
197 if (++count == deg_lambda)
200 if (deg_lambda != count) {
212 deg_omega = deg_lambda - 1;
215 for (j = i; j >= 0; j--) {
216 if ((
s[i - j] != nn) && (lambda[j] != nn))
218 alpha_to[rs_modnn(
rs,
s[i - j] + lambda[j])];
220 omega[
i] = index_of[
tmp];
227 for (j = count - 1; j >= 0; j--) {
229 for (i = deg_omega; i >= 0; i--) {
231 num1 ^= alpha_to[rs_modnn(
rs, omega[i] +
234 num2 = alpha_to[rs_modnn(
rs, root[j] * (fcr - 1) + nn)];
239 for (i =
min(deg_lambda, nroots - 1) & ~1; i >= 0; i -= 2) {
240 if (lambda[i + 1] != nn) {
241 den ^= alpha_to[rs_modnn(
rs, lambda[i + 1] +
246 if (num1 != 0 && loc[j] >= pad) {
247 uint16_t cor = alpha_to[rs_modnn(
rs,index_of[num1] +
249 nn - index_of[den])];
258 if (data && (loc[j] < (nn - nroots)))
259 data[loc[
j] -
pad] ^= cor;
265 if (eras_pos !=
NULL) {
267 eras_pos[i] = loc[i] - pad;