[Gmp-commit] /var/hg/gmp: t-mulmod_bknp1.c: Better coverage
mercurial at gmplib.org
mercurial at gmplib.org
Sun Feb 27 15:10:50 CET 2022
details: /var/hg/gmp/rev/1cafba189d5a
changeset: 18316:1cafba189d5a
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Feb 27 15:10:38 2022 +0100
description:
t-mulmod_bknp1.c: Better coverage
diffstat:
tests/mpn/t-mulmod_bknp1.c | 13 ++++++++++---
tests/mpn/t-sqrmod_bknp1.c | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
diffs (49 lines):
diff -r cf303403e643 -r 1cafba189d5a tests/mpn/t-mulmod_bknp1.c
--- a/tests/mpn/t-mulmod_bknp1.c Sat Feb 26 09:46:52 2022 +0100
+++ b/tests/mpn/t-mulmod_bknp1.c Sun Feb 27 15:10:38 2022 +0100
@@ -119,7 +119,7 @@
unsigned size_min;
unsigned size_range;
unsigned k;
- mp_size_t an,bn,rn,n;
+ mp_size_t rn, n;
mp_size_t itch;
mp_limb_t p_before, p_after, s_before, s_after;
@@ -137,7 +137,14 @@
if ((GMP_NUMB_MAX % k != 0) && (rn % 3 == 0))
n = rn / (k = 3);
- mpn_random2 (ap, rn + 1);
+ if (test == 0)
+ {
+ mpn_random2 (ap, n);
+ mpn_add_1 (ap + n, ap, n, 1); /* {ap,an} = -1 mod B+1 */
+ MPN_ZERO (ap + 2 * n, rn - 2 * n + 1);
+ }
+ else
+ mpn_random2 (ap, rn + 1);
mpn_random2 (bp, rn + 1);
bp [rn] &= 1;
@@ -153,7 +160,7 @@
s_before = scratch[-1];
s_after = scratch[itch];
- mpn_mulmod_bknp1 ( pp, ap, bp, n, k, scratch);
+ mpn_mulmod_bknp1 ( pp, ap, bp, n, k, scratch);
ref_mulmod_bnp1 (refp, ap, bp, rn);
if (pp[-1] != p_before || pp[rn + 1] != p_after
|| scratch[-1] != s_before || scratch[itch] != s_after
diff -r cf303403e643 -r 1cafba189d5a tests/mpn/t-sqrmod_bknp1.c
--- a/tests/mpn/t-sqrmod_bknp1.c Sat Feb 26 09:46:52 2022 +0100
+++ b/tests/mpn/t-sqrmod_bknp1.c Sun Feb 27 15:10:38 2022 +0100
@@ -118,7 +118,7 @@
unsigned size_min;
unsigned size_range;
unsigned k;
- mp_size_t an,rn,n;
+ mp_size_t rn, n;
mp_size_t itch;
mp_limb_t p_before, p_after, s_before, s_after;
More information about the gmp-commit
mailing list