POLY: use mp_neg() instead of directly modifying struct

This commit is contained in:
hasufell 2014-04-17 17:33:05 +02:00 committed by malte
parent 5c85862d12
commit f8b1649279

View File

@ -122,7 +122,7 @@ pb_poly *build_polynom(int const * const c,
mp_set_int(&(new_poly->terms[i]), unsigned_c); mp_set_int(&(new_poly->terms[i]), unsigned_c);
if (sign == true) if (sign == true)
new_poly->terms[i].sign = 1; mp_neg(&(new_poly->terms[i]), &(new_poly->terms[i]));
} }
} else { /* fill with zeros */ } else { /* fill with zeros */
for (unsigned int i = 0; i < len; i++) for (unsigned int i = 0; i < len; i++)
@ -239,7 +239,7 @@ bool pb_inverse_poly_q(pb_poly * const a,
PB_COPY(a, a_tmp); PB_COPY(a, a_tmp);
g = build_polynom(NULL, ctx->N, ctx); g = build_polynom(NULL, ctx->N, ctx);
mp_set(&(g->terms[0]), 1); mp_set(&(g->terms[0]), 1);
g->terms[0].sign = 1; mp_neg(&(g->terms[0]), &(g->terms[0]));
mp_set(&(g->terms[ctx->N]), 1); mp_set(&(g->terms[ctx->N]), 1);
while (1) { while (1) {