[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Nov 11 20:23:31 UTC 2018
details: /var/hg/gmp/rev/30009ae4e680
changeset: 17687:30009ae4e680
user: "Marco Bodrato <bodrato at mail.dm.unipi.it>"
date: Sat Nov 10 16:30:46 2018 +0100
description:
Improve comments
details: /var/hg/gmp/rev/6cd185dedd3b
changeset: 17688:6cd185dedd3b
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Thu Nov 08 21:55:29 2018 +0100
description:
Use TESTS_REPS.
diffstat:
mpn/generic/fib2m.c | 6 +++++-
tests/mpn/t-bdiv.c | 12 +-----------
tests/mpn/t-broot.c | 11 +----------
tests/mpn/t-brootinv.c | 11 +----------
tests/mpn/t-div.c | 11 +----------
tests/mpn/t-fib2m.c | 2 +-
tests/mpn/t-invert.c | 11 +----------
tests/mpn/t-minvert.c | 11 +----------
tests/mpn/t-mullo.c | 11 +----------
tests/mpn/t-mulmod_bnm1.c | 11 +----------
tests/mpn/t-sizeinbase.c | 11 +----------
tests/mpn/t-sqrlo.c | 11 +----------
tests/mpn/t-sqrmod_bnm1.c | 11 +----------
tests/mpn/toom-shared.h | 11 +----------
tests/mpn/toom-sqr-shared.h | 11 +----------
tests/mpq/reuse.c | 3 +--
tests/mpz/t-bin.c | 14 ++------------
tests/mpz/t-divis.c | 3 +--
tests/mpz/t-fac_ui.c | 4 ++--
tests/mpz/t-fib_ui.c | 4 ++--
tests/mpz/t-lucnum_ui.c | 4 ++--
tests/mpz/t-mfac_uiui.c | 4 ++--
tests/mpz/t-primorial_ui.c | 4 ++--
23 files changed, 33 insertions(+), 159 deletions(-)
diffs (truncated from 435 to 300 lines):
diff -r 923f7a777b33 -r 6cd185dedd3b mpn/generic/fib2m.c
--- a/mpn/generic/fib2m.c Sun Nov 11 12:43:58 2018 +0100
+++ b/mpn/generic/fib2m.c Thu Nov 08 21:55:29 2018 +0100
@@ -1,5 +1,8 @@
/* mpn_fib2m -- calculate Fibonacci numbers, modulo m.
+Contributed to the GNU project by Marco Bodrato, based on the previous
+fib2_ui.c file.
+
THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
@@ -81,7 +84,7 @@
In F[2k+1] with k odd, -2 is applied to F[k-1]^2 just by ORing into the
low limb.
- Should {tp, 2 * mn} be passed as a scratch pointer?
+ TODO: Should {tp, 2 * mn} be passed as a scratch pointer?
Should the call to mpn_fib2_ui() obtain (up to) 2*mn limbs?
*/
@@ -98,6 +101,7 @@
ASSERT (! MPN_OVERLAP_P (fp, MAX(2*mn+1,5), f1p, MAX(2*mn+1,5)));
ASSERT (nn > 0 && np[nn - 1] != 0);
+ /* Estimate the maximal n such that fibonacci(n) fits in mn limbs. */
#if GMP_NUMB_BITS % 16 == 0
if (UNLIKELY (ULONG_MAX / (23 * (GMP_NUMB_BITS / 16)) <= mn))
nfirst = ULONG_MAX;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-bdiv.c
--- a/tests/mpn/t-bdiv.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-bdiv.c Thu Nov 08 21:55:29 2018 +0100
@@ -143,17 +143,7 @@
mp_limb_t rran0, rran1, qran0, qran1;
TMP_DECL;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
-
+ TESTS_REPS (count, argv, argc);
maxdbits = MAX_DN;
maxnbits = MAX_NN;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-broot.c
--- a/tests/mpn/t-broot.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-broot.c Thu Nov 08 21:55:29 2018 +0100
@@ -38,16 +38,7 @@
TMP_MARK;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
rands = RANDS;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-brootinv.c
--- a/tests/mpn/t-brootinv.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-brootinv.c Thu Nov 08 21:55:29 2018 +0100
@@ -38,16 +38,7 @@
TMP_MARK;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
rands = RANDS;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-div.c
--- a/tests/mpn/t-div.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-div.c Thu Nov 08 21:55:29 2018 +0100
@@ -139,16 +139,7 @@
mp_limb_t rran0, rran1, qran0, qran1;
TMP_DECL;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
maxdbits = MAX_DN;
maxnbits = MAX_NN;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-fib2m.c
--- a/tests/mpn/t-fib2m.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-fib2m.c Thu Nov 08 21:55:29 2018 +0100
@@ -132,7 +132,7 @@
}
signflip ^= 1;
}
-
+
if (mpn_cmp (fks1m, fks1, mn) != 0)
{
if (mpn_sub_n (fks1, mp, fks1, mn) || mpn_cmp (fks1m, fks1, mn) != 0)
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-invert.c
--- a/tests/mpn/t-invert.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-invert.c Thu Nov 08 21:55:29 2018 +0100
@@ -71,16 +71,7 @@
TMP_DECL;
TMP_MARK;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
rands = RANDS;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-minvert.c
--- a/tests/mpn/t-minvert.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-minvert.c Thu Nov 08 21:55:29 2018 +0100
@@ -77,16 +77,7 @@
mpz_init (r);
mpz_init (g);
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
mp = TMP_ALLOC_LIMBS (MAX_SIZE);
ap = TMP_ALLOC_LIMBS (MAX_SIZE);
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-mullo.c
--- a/tests/mpn/t-mullo.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-mullo.c Thu Nov 08 21:55:29 2018 +0100
@@ -46,16 +46,7 @@
TMP_DECL;
TMP_MARK;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
rands = RANDS;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-mulmod_bnm1.c
--- a/tests/mpn/t-mulmod_bnm1.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-mulmod_bnm1.c Thu Nov 08 21:55:29 2018 +0100
@@ -84,16 +84,7 @@
TMP_DECL;
TMP_MARK;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
rands = RANDS;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-sizeinbase.c
--- a/tests/mpn/t-sizeinbase.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-sizeinbase.c Thu Nov 08 21:55:29 2018 +0100
@@ -46,16 +46,7 @@
gmp_randstate_ptr rands;
TMP_DECL;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
TMP_MARK;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-sqrlo.c
--- a/tests/mpn/t-sqrlo.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-sqrlo.c Thu Nov 08 21:55:29 2018 +0100
@@ -46,16 +46,7 @@
TMP_DECL;
TMP_MARK;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
rands = RANDS;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/t-sqrmod_bnm1.c
--- a/tests/mpn/t-sqrmod_bnm1.c Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/t-sqrmod_bnm1.c Thu Nov 08 21:55:29 2018 +0100
@@ -80,16 +80,7 @@
TMP_DECL;
TMP_MARK;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
rands = RANDS;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/toom-shared.h
--- a/tests/mpn/toom-shared.h Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/toom-shared.h Thu Nov 08 21:55:29 2018 +0100
@@ -60,16 +60,7 @@
TMP_DECL;
TMP_MARK;
- if (argc > 1)
- {
- char *end;
- count = strtol (argv[1], &end, 0);
- if (*end || count <= 0)
- {
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
- return 1;
- }
- }
+ TESTS_REPS (count, argv, argc);
tests_start ();
rands = RANDS;
diff -r 923f7a777b33 -r 6cd185dedd3b tests/mpn/toom-sqr-shared.h
--- a/tests/mpn/toom-sqr-shared.h Sun Nov 11 12:43:58 2018 +0100
+++ b/tests/mpn/toom-sqr-shared.h Thu Nov 08 21:55:29 2018 +0100
@@ -41,16 +41,7 @@
TMP_DECL;
TMP_MARK;
More information about the gmp-commit
mailing list