Skip to content

Commit

Permalink
Merge pull request #2113 from thofma/th/nmodpoly
Browse files Browse the repository at this point in the history
fix: nmod_poly with modulus 1
  • Loading branch information
albinahlback authored Nov 24, 2024
2 parents 3c28655 + 1859f82 commit a8f9854
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/nmod_poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,20 @@ int nmod_poly_is_zero(const nmod_poly_t poly)
NMOD_POLY_INLINE
int nmod_poly_is_one(const nmod_poly_t poly)
{
return (poly->mod.n == 0) || (poly->length == 1 && poly->coeffs[0] == 1);
return (poly->mod.n == UWORD(1)) || (poly->length == 1 && poly->coeffs[0] == 1);
}

/* bogus for non-prime modulus */
NMOD_POLY_INLINE
int nmod_poly_is_unit(const nmod_poly_t poly)
{
return (poly->length == 1) && poly->coeffs[0] != 0;
return (poly->mod.n == UWORD(1)) || ((poly->length == 1) && poly->coeffs[0] != 0);
}

NMOD_POLY_INLINE
int nmod_poly_is_gen(const nmod_poly_t poly)
{
return (poly->mod.n == 0) ||
return (poly->mod.n == UWORD(1)) ||
(poly->length == 2 && poly->coeffs[0] == 0 && poly->coeffs[1] == 1);
}

Expand Down

0 comments on commit a8f9854

Please sign in to comment.