Lines Matching refs: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 ^= (1 << i);
578 static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly,
583 if (poly->c[0])
584 /* poly[X] = bX+c with c!=0, root=c/b */
585 roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+
586 bch->a_log_tab[poly->c[1]]);
593 static int find_poly_deg2_roots(struct bch_control *bch, struct gf_poly *poly,
599 if (poly->c[0] && poly->c[1]) {
601 l0 = bch->a_log_tab[poly->c[0]];
602 l1 = bch->a_log_tab[poly->c[1]];
603 l2 = bch->a_log_tab[poly->c[2]];
635 static int find_poly_deg3_roots(struct bch_control *bch, struct gf_poly *poly,
641 if (poly->c[0]) {
643 e3 = poly->c[3];
644 c2 = gf_div(bch, poly->c[0], e3);
645 b2 = gf_div(bch, poly->c[1], e3);
646 a2 = gf_div(bch, poly->c[2], e3);
668 static int find_poly_deg4_roots(struct bch_control *bch, struct gf_poly *poly,
674 if (poly->c[0] == 0)
678 e4 = poly->c[4];
679 d = gf_div(bch, poly->c[0], e4);
680 c = gf_div(bch, poly->c[1], e4);
681 b = gf_div(bch, poly->c[2], e4);
682 a = gf_div(bch, poly->c[3], e4);
896 *h = &((struct gf_poly_deg1 *)f)[gcd->deg].poly;
908 struct gf_poly *poly, unsigned int *roots)
913 switch (poly->deg) {
916 cnt = find_poly_deg1_roots(bch, poly, roots);
919 cnt = find_poly_deg2_roots(bch, poly, roots);
922 cnt = find_poly_deg3_roots(bch, poly, roots);
925 cnt = find_poly_deg4_roots(bch, poly, roots);
930 if (poly->deg && (k <= GF_M(bch))) {
931 factor_polynomial(bch, k, poly, &f1, &f2);
1086 static int build_gf_tables(struct bch_control *bch, unsigned int poly)
1089 const unsigned int k = 1 << deg(poly);
1103 x ^= poly;