diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-11-02 00:01:48 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-11-02 00:01:48 +0000 |
commit | 94eaed5b44c271e940e92c05d7162534ce256caf (patch) | |
tree | 2b6075067639bb369ce00bc39e38fbff865f85a3 /src/util/integer_cln_imp.h | |
parent | 7b568f370f6ec4105414b562ee2a6fcb3d7048f2 (diff) |
better Integer asserts when there's overflow on conversion to unsigned long / long
Diffstat (limited to 'src/util/integer_cln_imp.h')
-rw-r--r-- | src/util/integer_cln_imp.h | 12 |
1 files changed, 8 insertions, 4 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); } |