[Gmp-commit] /var/hg/gmp: mpn/generic/mulmod_bnm1.c: Use mulmod_bknp1, on the...

mercurial at gmplib.org mercurial at gmplib.org
Fri Mar 4 10:04:11 CET 2022


details:   /var/hg/gmp/rev/6ff25532f2a4
changeset: 18319:6ff25532f2a4
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Mar 04 10:03:38 2022 +0100
description:
mpn/generic/mulmod_bnm1.c: Use mulmod_bknp1, on the bnp1 side.

diffstat:

 mpn/generic/mulmod_bnm1.c |  12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diffs (29 lines):

diff -r 1cbf890d4bff -r 6ff25532f2a4 mpn/generic/mulmod_bnm1.c
--- a/mpn/generic/mulmod_bnm1.c	Thu Mar 03 21:50:34 2022 +0100
+++ b/mpn/generic/mulmod_bnm1.c	Fri Mar 04 10:03:38 2022 +0100
@@ -68,6 +68,7 @@
 		    mp_ptr tp)
 {
   mp_limb_t cy;
+  unsigned k;
 
   ASSERT (0 < rn);
 
@@ -78,6 +79,17 @@
       else /* ap[rn] == 0 */
 	cy = mpn_neg (rp, ap, rn);
     }
+  else if (MPN_MULMOD_BKNP1_USABLE (rn, k, MUL_FFT_MODF_THRESHOLD))
+    {
+      mp_size_t n_k = rn / k;
+      TMP_DECL;
+
+      TMP_MARK;
+      mpn_mulmod_bknp1 (rp, ap, bp, n_k, k,
+                       TMP_ALLOC_LIMBS (mpn_mulmod_bknp1_itch (rn)));
+      TMP_FREE;
+      return;
+    }
   else
     {
       mpn_mul_n (tp, ap, bp, rn);


More information about the gmp-commit mailing list