Skip to content

Commit

Permalink
fix: nmod_poly with modulus 1
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma committed Nov 24, 2024
1 parent 3c28655 commit 1859f82
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)) ||

Check warning on line 204 in src/nmod_poly.h

View check run for this annotation

Codecov / codecov/patch

src/nmod_poly.h#L204

Added line #L204 was not covered by tests
(poly->length == 2 && poly->coeffs[0] == 0 && poly->coeffs[1] == 1);
}

Expand Down

0 comments on commit 1859f82

Please sign in to comment.