diff --git a/src/nmod_poly.h b/src/nmod_poly.h index 16bd376bbb..cb9a889f5c 100644 --- a/src/nmod_poly.h +++ b/src/nmod_poly.h @@ -206,7 +206,7 @@ void nmod_poly_one(nmod_poly_t res) res->coeffs[0] = 1; } -void nmod_poly_set_trunc(nmod_poly_t res, const nmod_poly_t poly, slong n); +void nmod_poly_set_trunc(nmod_poly_t res, const nmod_poly_t poly, slong len); NMOD_POLY_INLINE void nmod_poly_truncate(nmod_poly_t poly, slong len) diff --git a/src/nmod_poly/set_trunc.c b/src/nmod_poly/set_trunc.c index ae92c04c38..ee220aa950 100644 --- a/src/nmod_poly/set_trunc.c +++ b/src/nmod_poly/set_trunc.c @@ -17,10 +17,10 @@ nmod_poly_set_trunc(nmod_poly_t res, const nmod_poly_t poly, slong len) { if (poly == res) { - if (poly->length > len) + if (res->length > len) { - poly->length = len; - _nmod_poly_normalise(poly); + res->length = len; + _nmod_poly_normalise(res); } } else