commit 097ecfb7ec50b743edf82b34000454feb1475436
parent 29caf798449ce6ff1412b3141ba9ab448ba45a43
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Wed, 6 Dec 2023 23:13:21 +0900
-remove mpz_clear
Diffstat:
1 file changed, 0 insertions(+), 54 deletions(-)
diff --git a/source/montgomery.cl b/source/montgomery.cl
@@ -269,8 +269,6 @@ mpz_init2 (mpz_t r, mp_bitcnt_t bits);
void
mpz_init_set_ui (mpz_t r, unsigned long int x);
void
-mpz_clear (mpz_t r);
-void
gmp_die (const char *msg);
@@ -575,13 +573,6 @@ mpz_init_set_ui (mpz_t r, unsigned long int x)
mpz_set_ui (r, x);
}
-void
-mpz_clear (mpz_t r)
-{
- //if (r->_mp_alloc)
- //gmp_free_limbs (r->_mp_d, r->_mp_alloc);
-}
-
void
gmp_die (const char *msg)
@@ -603,7 +594,6 @@ mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
mpz_t bb;
mpz_init_set_ui (bb, b);
mpz_add (r, a, bb);
- mpz_clear (bb);
}
void
@@ -929,13 +919,9 @@ mpz_div_qr (mpz_t q, mpz_t r,
if (q)
{
mpz_swap (tq, q);
- mpz_clear (tq);
}
if (r)
mpz_swap (tr, r);
-
- mpz_clear (tr);
-
return rn != 0;
}
}
@@ -972,7 +958,6 @@ mpz_addmul (mpz_t r, const mpz_t u, const mpz_t v)
mpz_init (t);
mpz_mul (t, u, v);
mpz_add (r, r, t);
- mpz_clear (t);
}
void
@@ -1165,8 +1150,6 @@ mpz_invert (mpz_t r, const mpz_t u, const mpz_t m)
mpz_swap (r, tr);
}
- mpz_clear (g);
- mpz_clear (tr);
return invertible;
}
@@ -1499,12 +1482,7 @@ mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
}
- //if (tp)
- //gmp_free_limbs (tp, mn);
-
mpz_swap (r, tr);
- mpz_clear (tr);
- mpz_clear (base);
}
int
@@ -1721,7 +1699,6 @@ mpz_mul (mpz_t r, const mpz_t u, const mpz_t v)
t->_mp_size = sign ? - rn : rn;
mpz_swap (r, t);
- mpz_clear (t);
}
void
@@ -2334,13 +2311,6 @@ gz = GMP_MIN (uz, vz);
mpz_swap (s, s0);
if (t)
mpz_swap (t, t0);
-
- mpz_clear (tu);
- mpz_clear (tv);
- mpz_clear (s0);
- mpz_clear (s1);
- mpz_clear (t0);
- mpz_clear (t1);
}
@@ -2351,7 +2321,6 @@ mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
mpz_init_set_ui (t, v);
mpz_mul (t, u, t);
mpz_add (r, r, t);
- mpz_clear (t);
}
@@ -2414,9 +2383,6 @@ void mont_prepare_even_modulus(mpz_t m, mpz_t q, mpz_t powj) {
mpz_tdiv_q_2exp(q,m,j);
mpz_mul_2exp(powj,two,j - 1);
-
- mpz_clear(two);
-
}
// CPU
@@ -2469,10 +2435,6 @@ void mont_prepare(mpz_t b, mpz_t e, mpz_t m,
mpz_mod(M, M, m); // set M
mpz_mod(x, r, m); // set x
-
- mpz_clear(one);
- mpz_clear(oo);
-
}
// maybe GPU?
@@ -2499,12 +2461,7 @@ void mont_modexp(mpz_t ret,
mont_product(xx, aa, xx, r, r_1, n, ni);
}
-
mpz_set(ret, xx);
-
- mpz_clear(aa);
- mpz_clear(xx);
-
}
void mont_finish(mpz_t ret,
@@ -2522,10 +2479,6 @@ void mont_finish(mpz_t ret,
mont_product(x, xx, one, r, r_1, n, ni);
mpz_set(ret, x);
-
- mpz_clear(x);
- mpz_clear(one);
-
}
@@ -2565,13 +2518,6 @@ void mont_product(mpz_t ret,
mpz_sub(u, u, n);
mpz_set(ret, u);
-
- mpz_clear(ab);
- mpz_clear(mn);
- mpz_clear(t);
- mpz_clear(m);
- mpz_clear(u);
-
}
// not the fastest... but it does not increase the variable sizes