summaryrefslogtreecommitdiff
path: root/src/util/integer_gmp_imp.h
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2011-11-02 00:01:48 +0000
committerMorgan Deters <mdeters@gmail.com>2011-11-02 00:01:48 +0000
commit94eaed5b44c271e940e92c05d7162534ce256caf (patch)
tree2b6075067639bb369ce00bc39e38fbff865f85a3 /src/util/integer_gmp_imp.h
parent7b568f370f6ec4105414b562ee2a6fcb3d7048f2 (diff)
better Integer asserts when there's overflow on conversion to unsigned long / long
Diffstat (limited to 'src/util/integer_gmp_imp.h')
-rw-r--r--src/util/integer_gmp_imp.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util/integer_gmp_imp.h b/src/util/integer_gmp_imp.h
index f58c0f2ff..16ca8313b 100644
--- a/src/util/integer_gmp_imp.h
+++ b/src/util/integer_gmp_imp.h
@@ -187,13 +187,15 @@ public:
long getLong() const {
long si = d_value.get_si();
// ensure there wasn't overflow
- AlwaysAssert(mpz_cmp_si(d_value.get_mpz_t(), si) == 0);
+ AlwaysAssert(mpz_cmp_si(d_value.get_mpz_t(), si) == 0,
+ "Overflow detected in Integer::getLong()");
return si;
}
unsigned long getUnsignedLong() const {
unsigned long ui = d_value.get_ui();
// ensure there wasn't overflow
- AlwaysAssert(mpz_cmp_ui(d_value.get_mpz_t(), ui) == 0);
+ AlwaysAssert(mpz_cmp_ui(d_value.get_mpz_t(), ui) == 0,
+ "Overflow detected in Integer::getUnsignedLong()");
return ui;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback