summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/integer_cln_imp.h12
-rw-r--r--src/util/integer_gmp_imp.h6
2 files changed, 12 insertions, 6 deletions
diff --git a/src/util/integer_cln_imp.h b/src/util/integer_cln_imp.h
index 517e406ec..f8ffc0d65 100644
--- a/src/util/integer_cln_imp.h
+++ b/src/util/integer_cln_imp.h
@@ -247,15 +247,19 @@ public:
long getLong() const {
// ensure there isn't overflow
- Assert(d_value <= std::numeric_limits<long>::max());
- Assert(d_value >= std::numeric_limits<long>::min());
+ AlwaysAssert(d_value <= std::numeric_limits<long>::max(),
+ "Overflow detected in Integer::getLong()");
+ AlwaysAssert(d_value >= std::numeric_limits<long>::min(),
+ "Overflow detected in Integer::getLong()");
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());
+ AlwaysAssert(d_value <= std::numeric_limits<unsigned long>::max(),
+ "Overflow detected in Integer::getUnsignedLong()");
+ AlwaysAssert(d_value >= std::numeric_limits<unsigned long>::min(),
+ "Overflow detected in Integer::getUnsignedLong()");
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 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