[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Thu Apr 4 03:07:09 CEST 2013
details: /var/hg/gmp/rev/dcdd97c3435f
changeset: 15676:dcdd97c3435f
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Apr 04 03:06:47 2013 +0200
description:
Seed using RANDS, then use mpz_rrandomb.
details: /var/hg/gmp/rev/c760cf829380
changeset: 15677:c760cf829380
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Apr 04 03:06:58 2013 +0200
description:
ChangeLog
diffstat:
ChangeLog | 4 ++++
tests/mpn/logic.c | 27 +++++++++++++++++----------
2 files changed, 21 insertions(+), 10 deletions(-)
diffs (71 lines):
diff -r 255acd87440c -r c760cf829380 ChangeLog
--- a/ChangeLog Thu Apr 04 02:33:39 2013 +0200
+++ b/ChangeLog Thu Apr 04 03:06:58 2013 +0200
@@ -1,5 +1,9 @@
2013-04-04 Torbjorn Granlund <tege at gmplib.org>
+ * tests/mpn/logic.c: Seed using RANDS, then use mpz_rrandomb.
+
+ * tests/mpn/t-div.c (random_word): Remove. Let callers invoke urandom.
+
* mpn/sparc64/ultrasparct3/mul_1.asm: Rewrite.
* mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm: New file.
diff -r 255acd87440c -r c760cf829380 tests/mpn/logic.c
--- a/tests/mpn/logic.c Thu Apr 04 02:33:39 2013 +0200
+++ b/tests/mpn/logic.c Thu Apr 04 03:06:58 2013 +0200
@@ -57,8 +57,9 @@
int
main (int argc, char **argv)
{
+ mpz_t a, b;
mp_ptr ap, bp, rp, refp;
- mp_size_t max_n, n;
+ mp_size_t max_n, n, i;
gmp_randstate_ptr rands;
long test, reps = 1000;
TMP_SDECL;
@@ -67,21 +68,26 @@
tests_start ();
TESTS_REPS (reps, argv, argc);
- rands = RANDS;
+ mpz_inits (a, b, NULL);
- max_n = 32;
+ rands = RANDS; /* FIXME: not used */
- ap = TMP_SALLOC_LIMBS (max_n);
- bp = TMP_SALLOC_LIMBS (max_n);
- rp = TMP_SALLOC_LIMBS (max_n);
- refp = TMP_SALLOC_LIMBS (max_n);
+ max_n = 100;
+
+ rp = TMP_SALLOC_LIMBS (1 + max_n * 8 / GMP_LIMB_BITS);
+ refp = TMP_SALLOC_LIMBS (1 + max_n * 8 / GMP_LIMB_BITS);
for (test = 0; test < reps; test++)
{
- for (n = 1; n <= max_n; n++)
+ for (i = 1; i <= max_n; i++)
{
- mpn_random2 (ap, n);
- mpn_random2 (bp, n);
+ mpz_rrandomb (a, rands, i * 8);
+ mpz_rrandomb (b, rands, i * 8);
+ mpz_setbit (a, i * 8 - 1);
+ mpz_setbit (b, i * 8 - 1);
+ ap = PTR(a);
+ bp = PTR(b);
+ n = SIZ(a);
refmpn_and_n (refp, ap, bp, n);
mpn_and_n (rp, ap, bp, n);
@@ -122,6 +128,7 @@
}
TMP_SFREE;
+ mpz_clears (a, b, NULL);
tests_end ();
return 0;
}
More information about the gmp-commit
mailing list