fixes to assertions in GMP to match CLN behavior
authorMorgan Deters <mdeters@gmail.com>
Mon, 31 Oct 2011 23:56:07 +0000 (23:56 +0000)
committerMorgan Deters <mdeters@gmail.com>
Mon, 31 Oct 2011 23:56:07 +0000 (23:56 +0000)
src/util/integer_cln_imp.h
src/util/integer_gmp_imp.h

index b7a35fee8848e4525928422406a909dc50d0d806..517e406ec3a09c005779dd225182c27f03dae426 100644 (file)
@@ -246,12 +246,14 @@ public:
   //friend std::ostream& operator<<(std::ostream& os, const Integer& n);
 
   long getLong() const {
+    // ensure there isn't overflow
     Assert(d_value <= std::numeric_limits<long>::max());
     Assert(d_value >= std::numeric_limits<long>::min());
     return cln::cl_I_to_long(d_value);
   }
 
   unsigned long getUnsignedLong() const {
+    // ensure there isn't overflow
     Assert(d_value <= std::numeric_limits<unsigned long>::max());
     Assert(d_value >= std::numeric_limits<unsigned long>::min());
     return cln::cl_I_to_ulong(d_value);
index 4a075b8a19a168a5b707dcaaf85db30075699b0e..f58c0f2ffa31283f08ade47759ba73abef4baf67 100644 (file)
@@ -186,18 +186,14 @@ public:
 
   long getLong() const {
     long si = d_value.get_si();
-#ifdef CVC4_ASSERTIONS
     // ensure there wasn't overflow
-    Assert(mpz_cmp_si(d_value.get_mpz_t(), si) == 0);
-#endif /* CVC4_ASSERTIONS */
+    AlwaysAssert(mpz_cmp_si(d_value.get_mpz_t(), si) == 0);
     return si;
   }
   unsigned long getUnsignedLong() const {
     unsigned long ui = d_value.get_ui();
-#ifdef CVC4_ASSERTIONS
     // ensure there wasn't overflow
-    Assert(mpz_cmp_ui(d_value.get_mpz_t(), ui) == 0);
-#endif /* CVC4_ASSERTIONS */
+    AlwaysAssert(mpz_cmp_ui(d_value.get_mpz_t(), ui) == 0);
     return ui;
   }