From a39ad6584c1d61e22e72b53c3838f4f675ed2e19 Mon Sep 17 00:00:00 2001 From: Tim King Date: Thu, 24 Dec 2015 05:38:43 -0500 Subject: Miscellaneous fixes - Splitting the two instances of CheckArgument. The template version is now always defined in base/exception.h and is available in a cvc4_public header. This version has lost its variadic version (due to swig not supporting va_list's). The CPP macro version has been renamed PrettyCheckArgument. (Taking suggestions for a better name.) This is now only defined in base/cvc4_assert.h. Only use this in cvc4_private headers and in .cpp files that can use cvc4_private headers. To use a variadic version of CheckArguments, outside of this scope, you need to duplicate this macro locally. See cvc3_compat.cpp for an example. - Making fitsSignedInt() and fitsUnsignedInt() work more robustly for CLN on 32 bit systems. - Refactoring ArrayStoreAll to avoid potential problems with circular header inclusions. - Changing some headers to use iosfwd when possible. --- src/util/integer_gmp_imp.h | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'src/util/integer_gmp_imp.h') diff --git a/src/util/integer_gmp_imp.h b/src/util/integer_gmp_imp.h index 0d3122cd8..9cae16222 100644 --- a/src/util/integer_gmp_imp.h +++ b/src/util/integer_gmp_imp.h @@ -21,7 +21,7 @@ #define __CVC4__INTEGER_H #include -#include +#include #include #include "base/exception.h" @@ -190,17 +190,7 @@ public: * Returns the integer with the binary representation of size bits * extended with amount 1's */ - Integer oneExtend(uint32_t size, uint32_t amount) const { - // check that the size is accurate - DebugCheckArgument((*this) < Integer(1).multiplyByPow2(size), size); - mpz_class res = d_value; - - for (unsigned i = size; i < size + amount; ++i) { - mpz_setbit(res.get_mpz_t(), i); - } - - return Integer(res); - } + Integer oneExtend(uint32_t size, uint32_t amount) const; uint32_t toUnsignedInt() const { return mpz_get_ui(d_value.get_mpz_t()); @@ -319,12 +309,7 @@ public: /** * If y divides *this, then exactQuotient returns (this/y) */ - Integer exactQuotient(const Integer& y) const { - DebugCheckArgument(y.divides(*this), y); - mpz_class q; - mpz_divexact(q.get_mpz_t(), d_value.get_mpz_t(), y.d_value.get_mpz_t()); - return Integer( q ); - } + Integer exactQuotient(const Integer& y) const; /** * Returns y mod 2^exp @@ -430,14 +415,15 @@ public: long si = d_value.get_si(); // ensure there wasn't overflow CheckArgument(mpz_cmp_si(d_value.get_mpz_t(), si) == 0, this, - "Overflow detected in Integer::getLong()"); + "Overflow detected in Integer::getLong()."); return si; } + unsigned long getUnsignedLong() const { unsigned long ui = d_value.get_ui(); // ensure there wasn't overflow CheckArgument(mpz_cmp_ui(d_value.get_mpz_t(), ui) == 0, this, - "Overflow detected in Integer::getUnsignedLong()"); + "Overflow detected in Integer::getUnsignedLong()."); return ui; } -- cgit v1.2.3