Skip to content

Commit

Permalink
Do not mix references for mp_size_t and slong
Browse files Browse the repository at this point in the history
  • Loading branch information
albinahlback committed May 13, 2024
1 parent 4a1b547 commit f988e2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/fmpz_factor/ecm_select_curve.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ int
fmpz_factor_ecm_select_curve(nn_ptr f, nn_ptr sig, nn_ptr n, ecm_t ecm_inf)
{
slong sz, cy;
slong invlimbs, gcdlimbs;
mp_size_t invlimbs;
slong gcdlimbs;
nn_ptr temp, tempv, tempn, tempi, tempf;
int ret;

Expand Down Expand Up @@ -110,6 +111,8 @@ fmpz_factor_ecm_select_curve(nn_ptr f, nn_ptr sig, nn_ptr n, ecm_t ecm_inf)
flint_mpn_copyi(tempv, ecm_inf->v, sz);
flint_mpn_copyi(tempn, n, ecm_inf->n_size);

/* NOTE: invlimbs must be mp_size_t since it is strictly different from
* slong on Windows systems. */
gcdlimbs = mpn_gcdext(tempf, tempi, &invlimbs, tempv, sz, tempn, ecm_inf->n_size);

if (!(gcdlimbs == 1 && tempf[0] == ecm_inf->one[0]) &&
Expand Down
4 changes: 3 additions & 1 deletion src/mpn_mod/ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,14 +615,16 @@ mpn_mod_inv(nn_ptr res, nn_srcptr x, gr_ctx_t ctx)
ulong s[MPN_MOD_MAX_LIMBS];
ulong t[MPN_MOD_MAX_LIMBS];
ulong u[MPN_MOD_MAX_LIMBS];
slong gsize, ssize;
mp_size_t gsize, ssize;

if (mpn_mod_is_one(x, ctx) == T_TRUE || mpn_mod_is_neg_one(x, ctx) == T_TRUE)
return mpn_mod_set(res, x, ctx);

flint_mpn_copyi(t, x, n);
flint_mpn_copyi(u, d, n);
/* todo: does mpn_gcdext allow aliasing? */
/* NOTE: ssize must be mp_size_t since it is strictly different from slong
* on Windows systems. */
gsize = mpn_gcdext(g, s, &ssize, t, n, u, n);

if (gsize != 1 || g[0] != 1)
Expand Down

0 comments on commit f988e2d

Please sign in to comment.