[Gmp-commit] /var/hg/gmp: 2 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Sun Jan 20 12:27:43 CET 2013


details:   /var/hg/gmp/rev/41de8e3ff88c
changeset: 15327:41de8e3ff88c
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jan 20 12:27:29 2013 +0100
description:
Test mpn_sb_div_qr_sec and mpn_sb_div_r_sec.

details:   /var/hg/gmp/rev/79a14284250c
changeset: 15328:79a14284250c
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jan 20 12:27:36 2013 +0100
description:
ChangeLog

diffstat:

 ChangeLog         |   4 +++-
 tests/mpn/t-div.c |  32 +++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

diffs (57 lines):

diff -r 84d65b1cfd0e -r 79a14284250c ChangeLog
--- a/ChangeLog	Sun Jan 20 11:32:02 2013 +0100
+++ b/ChangeLog	Sun Jan 20 12:27:36 2013 +0100
@@ -1,4 +1,6 @@
-2013-01-20  TG  <tege at gmplib.org>
+2013-01-20  Torbjorn Granlund  <tege at gmplib.org>
+
+	* tests/mpn/t-div.c: Test mpn_sb_div_qr_sec and mpn_sb_div_r_sec.
 
 	* tests/mpz/t-remove.c: Back out last change which left `divisor_size'
 	uninitialised; achieve change's aim with a parameter tweak.
diff -r 84d65b1cfd0e -r 79a14284250c tests/mpn/t-div.c
--- a/tests/mpn/t-div.c	Sun Jan 20 11:32:02 2013 +0100
+++ b/tests/mpn/t-div.c	Sun Jan 20 12:27:36 2013 +0100
@@ -1,4 +1,4 @@
-/* Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+/* Copyright 2006, 2007, 2009, 2010, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -305,6 +305,36 @@
 	      qp[nn - dn] = mpn_sbpi1_div_q (qp, rp, nn, dp, dn, dinv.inv32);
 	      check_one (qp, NULL, np, nn, dp, dn, "mpn_sbpi1_div_q", 0);
 	    }
+
+	  /* Test mpn_sb_div_qr_sec */
+	  itch = 3 * nn + 4;
+	  if (itch + 1 > alloc)
+	    {
+	      scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+	      alloc = itch + 1;
+	    }
+	  scratch[itch] = ran;
+	  MPN_COPY (rp, np, nn);
+	  if (nn >= dn)
+	    MPN_ZERO (qp, nn - dn + 1);
+	  mpn_sb_div_qr_sec (qp, rp, nn, dp, dn, scratch);
+	  ASSERT_ALWAYS (ran == scratch[itch]);
+	  check_one (qp, rp, np, nn, dp, dn, "mpn_sb_div_qr_sec", 0);
+
+	  /* Test mpn_sb_div_r_sec */
+	  itch = nn + 2 * dn + 2;
+	  if (itch + 1 > alloc)
+	    {
+	      scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+	      alloc = itch + 1;
+	    }
+	  scratch[itch] = ran;
+	  MPN_COPY (rp, np, nn);
+	  mpn_sb_div_r_sec (rp, nn, dp, dn, scratch);
+	  ASSERT_ALWAYS (ran == scratch[itch]);
+	  /* Note: Since check_one cannot cope with random-only functions, we
+	     pass qp[] from the previous function, mpn_sb_div_qr_sec.  */
+	  check_one (qp, rp, np, nn, dp, dn, "mpn_sb_div_r_sec", 0);
 	}
 
       /* Test mpn_dcpi1_div_qr */


More information about the gmp-commit mailing list