[Gmp-commit] /home/hgfiles/gmp: Add parameter ASSERTs.

mercurial at gmplib.org mercurial at gmplib.org
Mon Dec 21 14:22:15 CET 2009


details:   /home/hgfiles/gmp/rev/be8c3543286e
changeset: 13154:be8c3543286e
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Dec 21 14:22:10 2009 +0100
description:
Add parameter ASSERTs.

diffstat:

 ChangeLog                     |  4 ++++
 mpn/generic/dcpi1_div_q.c     |  4 ++++
 mpn/generic/dcpi1_div_qr.c    |  2 +-
 mpn/generic/dcpi1_divappr_q.c |  4 ++++
 4 files changed, 13 insertions(+), 1 deletions(-)

diffs (53 lines):

diff -r 70e317dd1272 -r be8c3543286e ChangeLog
--- a/ChangeLog	Mon Dec 21 14:19:38 2009 +0100
+++ b/ChangeLog	Mon Dec 21 14:22:10 2009 +0100
@@ -1,5 +1,9 @@
 2009-12-21  Torbjorn Granlund  <tege at gmplib.org>
 
+	* mpn/generic/dcpi1_divappr_q.c: Add parameter ASSERTs.
+	* mpn/generic/dcpi1_div_q.c: Likewise.
+	* mpn/generic/dcpi1_div_qr.c: Change ASSERT to enforce dn >= 4.
+
 	* mpn/generic/bdiv_q_1.c (mpn_pi1_bdiv_q_1): Renamed from
 	mpn_bdiv_q_1_pi1.
 	* All references changed.
diff -r 70e317dd1272 -r be8c3543286e mpn/generic/dcpi1_div_q.c
--- a/mpn/generic/dcpi1_div_q.c	Mon Dec 21 14:19:38 2009 +0100
+++ b/mpn/generic/dcpi1_div_q.c	Mon Dec 21 14:22:10 2009 +0100
@@ -39,6 +39,10 @@
 
   TMP_MARK;
 
+  ASSERT (dn >= 4);
+  ASSERT (nn > dn);
+  ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT);
+
   tp = TMP_SALLOC_LIMBS (nn + 1);
   MPN_COPY (tp + 1, np, nn);
   tp[0] = 0;
diff -r 70e317dd1272 -r be8c3543286e mpn/generic/dcpi1_div_qr.c
--- a/mpn/generic/dcpi1_div_qr.c	Mon Dec 21 14:19:38 2009 +0100
+++ b/mpn/generic/dcpi1_div_qr.c	Mon Dec 21 14:22:10 2009 +0100
@@ -89,7 +89,7 @@
 
   TMP_MARK;
 
-  ASSERT (dn >= 2);
+  ASSERT (dn >= 4);
   ASSERT (nn > dn);
   ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT);
 
diff -r 70e317dd1272 -r be8c3543286e mpn/generic/dcpi1_divappr_q.c
--- a/mpn/generic/dcpi1_divappr_q.c	Mon Dec 21 14:19:38 2009 +0100
+++ b/mpn/generic/dcpi1_divappr_q.c	Mon Dec 21 14:22:10 2009 +0100
@@ -81,6 +81,10 @@
 
   TMP_MARK;
 
+  ASSERT (dn >= 4);
+  ASSERT (nn > dn);
+  ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT);
+
   tp = TMP_SALLOC_LIMBS (dn+1);
 
   qn = nn - dn;


More information about the gmp-commit mailing list