From ccf5b317ceb5509f17a75d234d568a6290aad6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Sun, 26 Feb 2012 17:18:00 +0100 Subject: Added mini-gmp. Use it for bootstrap. Deleted dumbmp.c. --- gen-psqr.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'gen-psqr.c') diff --git a/gen-psqr.c b/gen-psqr.c index 9c33d7a68..e43da6a1a 100644 --- a/gen-psqr.c +++ b/gen-psqr.c @@ -20,7 +20,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include #include -#include "dumbmp.c" +#include "bootstrap.c" /* The aim of this program is to choose either mpn_mod_34lsub1 or mpn_mod_1 @@ -152,9 +152,9 @@ f_cmp_fraction (const void *parg, const void *qarg) accordingly. */ #define COLLAPSE_ELEMENT(array, idx, narray) \ do { \ - mem_copyi ((char *) &(array)[idx], \ - (char *) &(array)[idx+1], \ - ((narray)-((idx)+1)) * sizeof (array[0])); \ + memmove (&(array)[idx], \ + &(array)[idx+1], \ + ((narray)-((idx)+1)) * sizeof (array[0])); \ (narray)--; \ } while (0) @@ -173,7 +173,7 @@ mul_2exp_mod (int n, int p, int m) int neg_mod (int n, int m) { - ASSERT (n >= 0 && n < m); + assert (n >= 0 && n < m); return (n == 0 ? 0 : m-n); } @@ -202,7 +202,7 @@ generate_sq_res_0x100 (int limb_bits) int i, res; nsq_res_0x100 = (0x100 + limb_bits - 1) / limb_bits; - sq_res_0x100 = (mpz_t *) xmalloc (nsq_res_0x100 * sizeof (*sq_res_0x100)); + sq_res_0x100 = xmalloc (nsq_res_0x100 * sizeof (*sq_res_0x100)); for (i = 0; i < nsq_res_0x100; i++) mpz_init_set_ui (sq_res_0x100[i], 0L); @@ -233,9 +233,8 @@ generate_mod (int limb_bits, int nail_bits) /* no more than limb_bits many factors in a one limb modulus (and of course in reality nothing like that many) */ factor_alloc = limb_bits; - factor = (struct factor_t *) xmalloc (factor_alloc * sizeof (*factor)); - rawfactor = (struct rawfactor_t *) - xmalloc (factor_alloc * sizeof (*rawfactor)); + factor = xmalloc (factor_alloc * sizeof (*factor)); + rawfactor = xmalloc (factor_alloc * sizeof (*rawfactor)); if (numb_bits % 4 != 0) { @@ -301,7 +300,7 @@ generate_mod (int limb_bits, int nail_bits) } while (mpz_sgn (r) == 0); - ASSERT (nrawfactor < factor_alloc); + assert (nrawfactor < factor_alloc); rawfactor[nrawfactor].divisor = i; rawfactor[nrawfactor].multiplicity = multiplicity; nrawfactor++; @@ -341,7 +340,7 @@ generate_mod (int limb_bits, int nail_bits) break; mpz_set (pp, new_pp); - ASSERT (nrawfactor < factor_alloc); + assert (nrawfactor < factor_alloc); rawfactor[nrawfactor].divisor = i; rawfactor[nrawfactor].multiplicity = 1; nrawfactor++; @@ -377,7 +376,7 @@ generate_mod (int limb_bits, int nail_bits) for (i = 0; i < nrawfactor; i++) { int j; - ASSERT (nfactor < factor_alloc); + assert (nfactor < factor_alloc); factor[nfactor].divisor = 1; for (j = 0; j < rawfactor[i].multiplicity; j++) factor[nfactor].divisor *= rawfactor[i].divisor; -- cgit v1.2.1