summaryrefslogtreecommitdiff
path: root/src/util/integer_gmp_imp.h
diff options
context:
space:
mode:
authorTim King <taking@google.com>2015-12-24 05:38:43 -0500
committerTim King <taking@google.com>2015-12-24 05:38:43 -0500
commita39ad6584c1d61e22e72b53c3838f4f675ed2e19 (patch)
treeed40cb371c41ac285ca2bf41a82254a36134e132 /src/util/integer_gmp_imp.h
parent87b0fe9ce10d1e5e9ed5a3e7db77f46bf3f68922 (diff)
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.
Diffstat (limited to 'src/util/integer_gmp_imp.h')
-rw-r--r--src/util/integer_gmp_imp.h26
1 files changed, 6 insertions, 20 deletions
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 <string>
-#include <iostream>
+#include <iosfwd>
#include <limits>
#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;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback