Berlekamp–Massey algorithm: Difference between revisions

Content deleted Content added
Code sample for the binary field in Java: made variables match closer to pseudocode; using char[] arrays instead of int[] for easier conversion to and from strings; made output something more usable than simply length of polynomial ~~~~
Line 168:
for (int N = 0; N < n; N++) {
int d = s[N];
for (int i = 1; i <= L; i++) {d ^= (c[i] & s[N - i]);
d ^= (c[i] & s[N - i]);
}
if (d == 1) {
System.arraycopy(c, 0, t, 0, n);
int diff = N - m;
for (int i = 0, j = diff; j < n; i++, j++) {c[j] ^= b[i];
if (L <= N c[j]/ ^=2) b[i];{
L = N + 1 - L;
d ^= (c[i] & s[Nm -= i])N;
System.arraycopy(t, 0, b, 0, n);
}
if (L <= N / 2) {}
L = N + 1 - L;
m = N;
System.arraycopy(t, 0, b, 0, n);
}
}
}
return stringify(c, L);