Lines Matching +full:0 +full:x409

98 #define dbg(_fmt, args...)     do {} while (0)
140 p = bch->mod8_tab + (l+1)*(((ecc[0] >> 24)^(tmp)) & 0xff); in bch_encode_unaligned()
142 for (i = 0; i < l; i++) in bch_encode_unaligned()
155 uint8_t pad[4] = {0, 0, 0, 0}; in load_ecc8()
158 for (i = 0; i < nwords; i++, src += 4) in load_ecc8()
159 dst[i] = ((u32)swap_bits(bch, src[0]) << 24) | in load_ecc8()
165 dst[nwords] = ((u32)swap_bits(bch, pad[0]) << 24) | in load_ecc8()
180 for (i = 0; i < nwords; i++) { in store_ecc8()
186 pad[0] = swap_bits(bch, src[nwords] >> 24); in store_ecc8()
202 * @ecc_bytes of @bch, and should be initialized to 0 before the first call.
228 memset(bch->ecc_buf, 0, r_bytes); in bch_encode()
250 * 31 ...24 23 ...16 15 ... 8 7 ... 0 in bch_encode()
266 w ^= r[0]; in bch_encode()
267 p0 = tab0 + (l+1)*((w >> 0) & 0xff); in bch_encode()
268 p1 = tab1 + (l+1)*((w >> 8) & 0xff); in bch_encode()
269 p2 = tab2 + (l+1)*((w >> 16) & 0xff); in bch_encode()
270 p3 = tab3 + (l+1)*((w >> 24) & 0xff); in bch_encode()
272 for (i = 0; i < l; i++) in bch_encode()
322 x = (x & 0x11111111U) * 0x11111111U; in parity()
332 bch->a_log_tab[b])] : 0; in gf_mul()
337 return a ? bch->a_pow_tab[mod_s(bch, 2*bch->a_log_tab[a])] : 0; in gf_sqr()
344 GF_N(bch)-bch->a_log_tab[b])] : 0; in gf_div()
384 memset(syn, 0, 2*t*sizeof(*syn)); in compute_syndromes()
392 for (j = 0; j < 2*t; j += 2) in compute_syndromes()
397 } while (s > 0); in compute_syndromes()
400 for (j = 0; j < t; j++) in compute_syndromes()
414 unsigned int i, j, tmp, l, pd = 1, d = syn[0]; in compute_error_locator_polynomial()
416 struct gf_poly *pelp = bch->poly_2t[0]; in compute_error_locator_polynomial()
420 memset(pelp, 0, GF_POLY_SZ(2*t)); in compute_error_locator_polynomial()
421 memset(elp, 0, GF_POLY_SZ(2*t)); in compute_error_locator_polynomial()
423 pelp->deg = 0; in compute_error_locator_polynomial()
424 pelp->c[0] = 1; in compute_error_locator_polynomial()
425 elp->deg = 0; in compute_error_locator_polynomial()
426 elp->c[0] = 1; in compute_error_locator_polynomial()
429 for (i = 0; (i < t) && (elp->deg <= t); i++) { in compute_error_locator_polynomial()
435 for (j = 0; j <= pelp->deg; j++) { in compute_error_locator_polynomial()
472 k = 0; in solve_linear_system()
476 for (c = 0; c < m; c++) { in solve_linear_system()
477 rem = 0; in solve_linear_system()
505 if (k > 0) { in solve_linear_system()
507 for (r = m-1; r >= 0; r--) { in solve_linear_system()
510 return 0; in solve_linear_system()
519 return 0; in solve_linear_system()
521 for (p = 0; p < nsol; p++) { in solve_linear_system()
523 for (c = 0; c < k; c++) in solve_linear_system()
527 tmp = 0; in solve_linear_system()
528 for (r = m-1; r >= 0; r--) { in solve_linear_system()
547 unsigned int mask = 0xff, t, rows[16] = {0,}; in find_affine4_roots()
551 rows[0] = c; in find_affine4_roots()
553 /* build linear system to solve X^4+aX^2+bX+c = 0 */ in find_affine4_roots()
554 for (i = 0; i < m; i++) { in find_affine4_roots()
556 (a ? bch->a_pow_tab[mod_s(bch, k)] : 0)^ in find_affine4_roots()
557 (b ? bch->a_pow_tab[mod_s(bch, j)] : 0); in find_affine4_roots()
565 for (j = 8; j != 0; j >>= 1, mask ^= (mask << j)) { in find_affine4_roots()
566 for (k = 0; k < 16; k = (k+j+1) & ~j) { in find_affine4_roots()
581 int n = 0; in find_poly_deg1_roots()
583 if (poly->c[0]) in find_poly_deg1_roots()
584 /* poly[X] = bX+c with c!=0, root=c/b */ in find_poly_deg1_roots()
585 roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+ in find_poly_deg1_roots()
596 int n = 0, i, l0, l1, l2; in find_poly_deg2_roots()
599 if (poly->c[0] && poly->c[1]) { in find_poly_deg2_roots()
601 l0 = bch->a_log_tab[poly->c[0]]; in find_poly_deg2_roots()
608 * let u = sum(li.a^i) i=0..m-1; then compute r = sum(li.xi): in find_poly_deg2_roots()
611 * i.e. r and r+1 are roots iff Tr(u)=0 in find_poly_deg2_roots()
613 r = 0; in find_poly_deg2_roots()
638 int i, n = 0; in find_poly_deg3_roots()
641 if (poly->c[0]) { in find_poly_deg3_roots()
644 c2 = gf_div(bch, poly->c[0], e3); in find_poly_deg3_roots()
656 for (i = 0; i < 4; i++) { in find_poly_deg3_roots()
671 int i, l, n = 0; in find_poly_deg4_roots()
672 unsigned int a, b, c, d, e = 0, f, a2, b2, c2, e4; in find_poly_deg4_roots()
674 if (poly->c[0] == 0) in find_poly_deg4_roots()
675 return 0; in find_poly_deg4_roots()
679 d = gf_div(bch, poly->c[0], e4); in find_poly_deg4_roots()
686 /* first, eliminate cX by using z=X+e with ae^2+c=0 */ in find_poly_deg4_roots()
691 l += (l & 1) ? GF_N(bch) : 0; in find_poly_deg4_roots()
704 if (d == 0) in find_poly_deg4_roots()
706 return 0; in find_poly_deg4_roots()
719 for (i = 0; i < 4; i++) { in find_poly_deg4_roots()
737 /* represent 0 values with -1; warning, rep[d] is not set to 1 */ in gf_poly_logrep()
738 for (i = 0; i < d; i++) in gf_poly_logrep()
765 for (i = 0; i < d; i++, p++) { in gf_poly_mod()
767 if (m >= 0) in gf_poly_mod()
791 q->deg = 0; in gf_poly_div()
792 q->c[0] = 0; in gf_poly_div()
812 while (b->deg > 0) { in gf_poly_gcd()
837 z->c[0] = 0; in compute_trace_bk_mod()
840 out->deg = 0; in compute_trace_bk_mod()
841 memset(out, 0, GF_POLY_SZ(f->deg)); in compute_trace_bk_mod()
846 for (i = 0; i < m; i++) { in compute_trace_bk_mod()
848 for (j = z->deg; j >= 0; j--) { in compute_trace_bk_mod()
851 z->c[2*j+1] = 0; in compute_trace_bk_mod()
874 struct gf_poly *f2 = bch->poly_2t[0]; in factor_polynomial()
888 if (tk->deg > 0) { in factor_polynomial()
929 cnt = 0; in find_poly_roots()
951 unsigned int i, j, syn, syn0, count = 0; in chien_search()
956 bch->cache[p->deg] = 0; in chien_search()
957 syn0 = gf_div(bch, p->c[0], p->c[p->deg]); in chien_search()
963 if (m >= 0) in chien_search()
966 if (syn == 0) { in chien_search()
972 return (count == p->deg) ? count : 0; in chien_search()
1047 for (i = 0, sum = 0; i < (int)ecc_words; i++) { in bch_decode()
1053 return 0; in bch_decode()
1060 if (err > 0) { in bch_decode()
1065 if (err > 0) { in bch_decode()
1068 for (i = 0; i < err; i++) { in bch_decode()
1079 return (err >= 0) ? err : -EBADMSG; in bch_decode()
1095 for (i = 0; i < GF_N(bch); i++) { in build_gf_tables()
1099 /* polynomial is not primitive (a^i=1 with 0<i<2^m-1) */ in build_gf_tables()
1106 bch->a_log_tab[0] = 0; in build_gf_tables()
1108 return 0; in build_gf_tables()
1122 memset(bch->mod8_tab, 0, 4*256*l*sizeof(*bch->mod8_tab)); in build_mod8_tables()
1124 for (i = 0; i < 256; i++) { in build_mod8_tables()
1126 for (b = 0; b < 4; b++) { in build_mod8_tables()
1133 data ^= g[0] >> (31-d); in build_mod8_tables()
1134 for (j = 0; j < ecclen; j++) { in build_mod8_tables()
1135 hi = (d < 31) ? g[j] << (d+1) : 0; in build_mod8_tables()
1137 g[j+1] >> (31-d) : 0; in build_mod8_tables()
1152 unsigned int sum, x, y, remaining, ak = 0, xi[BCH_MAX_M]; in build_deg2_base()
1154 /* find k s.t. Tr(a^k) = 1 and 0 <= k < m */ in build_deg2_base()
1155 for (i = 0; i < m; i++) { in build_deg2_base()
1156 for (j = 0, sum = 0; j < m; j++) in build_deg2_base()
1164 /* find xi, i=0..m-1 such that xi^2+xi = a^i+Tr(a^i).a^k */ in build_deg2_base()
1166 memset(xi, 0, sizeof(xi)); in build_deg2_base()
1168 for (x = 0; (x <= GF_N(bch)) && remaining; x++) { in build_deg2_base()
1170 for (i = 0; i < 2; i++) { in build_deg2_base()
1183 return remaining ? -1 : 0; in build_deg2_base()
1203 int n, err = 0; in compute_generator_polynomial()
1219 memset(roots , 0, (bch->n+1)*sizeof(*roots)); in compute_generator_polynomial()
1220 for (i = 0; i < t; i++) { in compute_generator_polynomial()
1221 for (j = 0, r = 2*i+1; j < m; j++) { in compute_generator_polynomial()
1227 g->deg = 0; in compute_generator_polynomial()
1228 g->c[0] = 1; in compute_generator_polynomial()
1229 for (i = 0; i < GF_N(bch); i++) { in compute_generator_polynomial()
1234 for (j = g->deg; j > 0; j--) in compute_generator_polynomial()
1237 g->c[0] = gf_mul(bch, g->c[0], r); in compute_generator_polynomial()
1243 i = 0; in compute_generator_polynomial()
1245 while (n > 0) { in compute_generator_polynomial()
1247 for (j = 0, word = 0; j < nbits; j++) { in compute_generator_polynomial()
1267 * @prim_poly: user-provided primitive polynomial (or 0 to use default)
1288 int err = 0; in bch_init()
1297 0x25, 0x43, 0x83, 0x11d, 0x211, 0x409, 0x805, 0x1053, 0x201b, in bch_init()
1298 0x402b, 0x8003, in bch_init()
1330 if (prim_poly == 0) in bch_init()
1353 for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++) in bch_init()
1402 for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++) in bch_free()