Lines Matching defs:poly

114 	struct gf_poly poly;
308 static inline int deg(unsigned int poly)
311 return fls(poly)-1;
375 uint32_t poly;
388 poly = *ecc++;
390 while (poly) {
391 i = deg(poly);
395 poly ^= (1u << i);
575 static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly,
580 if (poly->c[0])
581 /* poly[X] = bX+c with c!=0, root=c/b */
582 roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+
583 bch->a_log_tab[poly->c[1]]);
590 static int find_poly_deg2_roots(struct bch_control *bch, struct gf_poly *poly,
596 if (poly->c[0] && poly->c[1]) {
598 l0 = bch->a_log_tab[poly->c[0]];
599 l1 = bch->a_log_tab[poly->c[1]];
600 l2 = bch->a_log_tab[poly->c[2]];
632 static int find_poly_deg3_roots(struct bch_control *bch, struct gf_poly *poly,
638 if (poly->c[0]) {
640 e3 = poly->c[3];
641 c2 = gf_div(bch, poly->c[0], e3);
642 b2 = gf_div(bch, poly->c[1], e3);
643 a2 = gf_div(bch, poly->c[2], e3);
665 static int find_poly_deg4_roots(struct bch_control *bch, struct gf_poly *poly,
671 if (poly->c[0] == 0)
675 e4 = poly->c[4];
676 d = gf_div(bch, poly->c[0], e4);
677 c = gf_div(bch, poly->c[1], e4);
678 b = gf_div(bch, poly->c[2], e4);
679 a = gf_div(bch, poly->c[3], e4);
886 *h = &((struct gf_poly_deg1 *)f)[gcd->deg].poly;
898 struct gf_poly *poly, unsigned int *roots)
903 switch (poly->deg) {
906 cnt = find_poly_deg1_roots(bch, poly, roots);
909 cnt = find_poly_deg2_roots(bch, poly, roots);
912 cnt = find_poly_deg3_roots(bch, poly, roots);
915 cnt = find_poly_deg4_roots(bch, poly, roots);
920 if (poly->deg && (k <= GF_M(bch))) {
921 factor_polynomial(bch, k, poly, &f1, &f2);
1076 static int build_gf_tables(struct bch_control *bch, unsigned int poly)
1079 const unsigned int k = 1 << deg(poly);
1093 x ^= poly;