[Gmp-commit] /var/hg/gmp: (main): Test mpn_sbpi1_bdiv_r.

mercurial at gmplib.org mercurial at gmplib.org
Fri Jul 21 18:07:03 UTC 2017


details:   /var/hg/gmp/rev/04f65ecbea93
changeset: 17474:04f65ecbea93
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Fri Jul 21 20:05:54 2017 +0200
description:
(main): Test mpn_sbpi1_bdiv_r.

diffstat:

 tests/mpn/t-bdiv.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r bf9a009a2025 -r 04f65ecbea93 tests/mpn/t-bdiv.c
--- a/tests/mpn/t-bdiv.c	Fri Jul 21 18:32:31 2017 +0200
+++ b/tests/mpn/t-bdiv.c	Fri Jul 21 20:05:54 2017 +0200
@@ -256,10 +256,7 @@
 	      ASSERT_ALWAYS (qp[-1] == qran0);  ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
 	      ASSERT_ALWAYS (rp[-1] == rran0);
 	      check_one (qp, rp + nn - dn, rh, np, nn, dp, dn, "mpn_sbpi1_bdiv_qr");
-	    }
 
-	  if (nn > dn)
-	    {
 	      /* Test mpn_sbpi1_bdiv_q */
 	      MPN_COPY (rp, np, nn);
 	      MPN_ZERO (qp, nn - dn);
@@ -267,6 +264,12 @@
 	      ASSERT_ALWAYS (qp[-1] == qran0);  ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
 	      ASSERT_ALWAYS (rp[-1] == rran0);
 	      check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_sbpi1_bdiv_q");
+
+	      /* Test mpn_sbpi1_bdiv_r; we use mpn_sbpi1_bdiv_q's quotient. */
+	      MPN_COPY (rp, np, nn);
+	      mpn_sbpi1_bdiv_r (rp, nn - dn, dp, MIN(dn,nn-dn), -dinv);
+	      ASSERT_ALWAYS (rp[-1] == rran0);
+	      check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_sbpi1_bdiv_r");
 	    }
 	}
 


More information about the gmp-commit mailing list