Skip to content

Commit

Permalink
inline operation in _gr_fmpz_set
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson committed Feb 2, 2025
1 parent a71fd14 commit b569347
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/gr/fmpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,17 @@ _gr_fmpz_equal(const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx)
int
_gr_fmpz_set(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx)
{
fmpz_set(res, x);
if (res == x)
return GR_SUCCESS;

if (!COEFF_IS_MPZ(*x))
{
_fmpz_demote(res);
*res = *x;
}
else
mpz_set(_fmpz_promote(res), COEFF_TO_PTR(*x));

return GR_SUCCESS;
}

Expand Down

0 comments on commit b569347

Please sign in to comment.