diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-10-31 23:56:07 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-10-31 23:56:07 +0000 |
commit | cbd5934ffce739fcc5ade1f8fdefcd0a04e0d9ef (patch) | |
tree | 4e4df17132766e6995995232f5dbfde94de89af4 /src | |
parent | 9251373a4ca35e35c6d1d2740e6c958a85f0a329 (diff) |
fixes to assertions in GMP to match CLN behavior
Diffstat (limited to 'src')
-rw-r--r-- | src/util/integer_cln_imp.h | 2 | ||||
-rw-r--r-- | src/util/integer_gmp_imp.h | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/util/integer_cln_imp.h b/src/util/integer_cln_imp.h index b7a35fee8..517e406ec 100644 --- a/src/util/integer_cln_imp.h +++ b/src/util/integer_cln_imp.h @@ -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); diff --git a/src/util/integer_gmp_imp.h b/src/util/integer_gmp_imp.h index 4a075b8a1..f58c0f2ff 100644 --- a/src/util/integer_gmp_imp.h +++ b/src/util/integer_gmp_imp.h @@ -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; } |