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()
502 if (k > 0) { in solve_linear_system()
504 for (r = m-1; r >= 0; r--) { in solve_linear_system()
507 return 0; in solve_linear_system()
516 return 0; in solve_linear_system()
518 for (p = 0; p < nsol; p++) { in solve_linear_system()
520 for (c = 0; c < k; c++) in solve_linear_system()
524 tmp = 0; in solve_linear_system()
525 for (r = m-1; r >= 0; r--) { in solve_linear_system()
544 unsigned int mask = 0xff, t, rows[16] = {0,}; in find_affine4_roots()
548 rows[0] = c; in find_affine4_roots()
550 /* build linear system to solve X^4+aX^2+bX+c = 0 */ in find_affine4_roots()
551 for (i = 0; i < m; i++) { in find_affine4_roots()
553 (a ? bch->a_pow_tab[mod_s(bch, k)] : 0)^ in find_affine4_roots()
554 (b ? bch->a_pow_tab[mod_s(bch, j)] : 0); in find_affine4_roots()
562 for (j = 8; j != 0; j >>= 1, mask ^= (mask << j)) { in find_affine4_roots()
563 for (k = 0; k < 16; k = (k+j+1) & ~j) { in find_affine4_roots()
578 int n = 0; in find_poly_deg1_roots()
580 if (poly->c[0]) in find_poly_deg1_roots()
581 /* poly[X] = bX+c with c!=0, root=c/b */ in find_poly_deg1_roots()
582 roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+ in find_poly_deg1_roots()
593 int n = 0, i, l0, l1, l2; in find_poly_deg2_roots()
596 if (poly->c[0] && poly->c[1]) { in find_poly_deg2_roots()
598 l0 = bch->a_log_tab[poly->c[0]]; in find_poly_deg2_roots()
605 * let u = sum(li.a^i) i=0..m-1; then compute r = sum(li.xi): in find_poly_deg2_roots()
608 * i.e. r and r+1 are roots iff Tr(u)=0 in find_poly_deg2_roots()
610 r = 0; in find_poly_deg2_roots()
635 int i, n = 0; in find_poly_deg3_roots()
638 if (poly->c[0]) { in find_poly_deg3_roots()
641 c2 = gf_div(bch, poly->c[0], e3); in find_poly_deg3_roots()
653 for (i = 0; i < 4; i++) { in find_poly_deg3_roots()
668 int i, l, n = 0; in find_poly_deg4_roots()
669 unsigned int a, b, c, d, e = 0, f, a2, b2, c2, e4; in find_poly_deg4_roots()
671 if (poly->c[0] == 0) in find_poly_deg4_roots()
672 return 0; in find_poly_deg4_roots()
676 d = gf_div(bch, poly->c[0], e4); in find_poly_deg4_roots()
683 /* first, eliminate cX by using z=X+e with ae^2+c=0 */ in find_poly_deg4_roots()
688 l += (l & 1) ? GF_N(bch) : 0; in find_poly_deg4_roots()
701 if (d == 0) in find_poly_deg4_roots()
703 return 0; in find_poly_deg4_roots()
716 for (i = 0; i < 4; i++) { in find_poly_deg4_roots()
734 /* represent 0 values with -1; warning, rep[d] is not set to 1 */ in gf_poly_logrep()
735 for (i = 0; i < d; i++) in gf_poly_logrep()
762 for (i = 0; i < d; i++, p++) { in gf_poly_mod()
764 if (m >= 0) in gf_poly_mod()
788 q->deg = 0; in gf_poly_div()
789 q->c[0] = 0; in gf_poly_div()
804 while (b->deg > 0) { in gf_poly_gcd()
827 z->c[0] = 0; in compute_trace_bk_mod()
830 out->deg = 0; in compute_trace_bk_mod()
831 memset(out, 0, GF_POLY_SZ(f->deg)); in compute_trace_bk_mod()
836 for (i = 0; i < m; i++) { in compute_trace_bk_mod()
838 for (j = z->deg; j >= 0; j--) { in compute_trace_bk_mod()
841 z->c[2*j+1] = 0; in compute_trace_bk_mod()
864 struct gf_poly *f2 = bch->poly_2t[0]; in factor_polynomial()
878 if (tk->deg > 0) { in factor_polynomial()
919 cnt = 0; in find_poly_roots()
941 unsigned int i, j, syn, syn0, count = 0; in chien_search()
946 bch->cache[p->deg] = 0; in chien_search()
947 syn0 = gf_div(bch, p->c[0], p->c[p->deg]); in chien_search()
953 if (m >= 0) in chien_search()
956 if (syn == 0) { in chien_search()
962 return (count == p->deg) ? count : 0; in chien_search()
1037 for (i = 0, sum = 0; i < (int)ecc_words; i++) { in bch_decode()
1043 return 0; in bch_decode()
1050 if (err > 0) { in bch_decode()
1055 if (err > 0) { in bch_decode()
1058 for (i = 0; i < err; i++) { in bch_decode()
1069 return (err >= 0) ? err : -EBADMSG; in bch_decode()
1085 for (i = 0; i < GF_N(bch); i++) { in build_gf_tables()
1089 /* polynomial is not primitive (a^i=1 with 0<i<2^m-1) */ in build_gf_tables()
1096 bch->a_log_tab[0] = 0; in build_gf_tables()
1098 return 0; in build_gf_tables()
1112 memset(bch->mod8_tab, 0, 4*256*l*sizeof(*bch->mod8_tab)); in build_mod8_tables()
1114 for (i = 0; i < 256; i++) { in build_mod8_tables()
1116 for (b = 0; b < 4; b++) { in build_mod8_tables()
1123 data ^= g[0] >> (31-d); in build_mod8_tables()
1124 for (j = 0; j < ecclen; j++) { in build_mod8_tables()
1125 hi = (d < 31) ? g[j] << (d+1) : 0; in build_mod8_tables()
1127 g[j+1] >> (31-d) : 0; in build_mod8_tables()
1142 unsigned int sum, x, y, remaining, ak = 0, xi[BCH_MAX_M]; in build_deg2_base()
1144 /* find k s.t. Tr(a^k) = 1 and 0 <= k < m */ in build_deg2_base()
1145 for (i = 0; i < m; i++) { in build_deg2_base()
1146 for (j = 0, sum = 0; j < m; j++) in build_deg2_base()
1154 /* find xi, i=0..m-1 such that xi^2+xi = a^i+Tr(a^i).a^k */ in build_deg2_base()
1156 memset(xi, 0, sizeof(xi)); in build_deg2_base()
1158 for (x = 0; (x <= GF_N(bch)) && remaining; x++) { in build_deg2_base()
1160 for (i = 0; i < 2; i++) { in build_deg2_base()
1173 return remaining ? -1 : 0; in build_deg2_base()
1193 int n, err = 0; in compute_generator_polynomial()
1209 memset(roots , 0, (bch->n+1)*sizeof(*roots)); in compute_generator_polynomial()
1210 for (i = 0; i < t; i++) { in compute_generator_polynomial()
1211 for (j = 0, r = 2*i+1; j < m; j++) { in compute_generator_polynomial()
1217 g->deg = 0; in compute_generator_polynomial()
1218 g->c[0] = 1; in compute_generator_polynomial()
1219 for (i = 0; i < GF_N(bch); i++) { in compute_generator_polynomial()
1224 for (j = g->deg; j > 0; j--) in compute_generator_polynomial()
1227 g->c[0] = gf_mul(bch, g->c[0], r); in compute_generator_polynomial()
1233 i = 0; in compute_generator_polynomial()
1235 while (n > 0) { in compute_generator_polynomial()
1237 for (j = 0, word = 0; j < nbits; j++) { in compute_generator_polynomial()
1257 * @prim_poly: user-provided primitive polynomial (or 0 to use default)
1278 int err = 0; in bch_init()
1287 0x25, 0x43, 0x83, 0x11d, 0x211, 0x409, 0x805, 0x1053, 0x201b, in bch_init()
1288 0x402b, 0x8003, in bch_init()
1320 if (prim_poly == 0) in bch_init()
1343 for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++) in bch_init()
1392 for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++) in bch_free()