summaryrefslogtreecommitdiff
path: root/src/util/integer_cln_imp.h
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2011-10-31 21:43:11 +0000
committerTim King <taking@cs.nyu.edu>2011-10-31 21:43:11 +0000
commit9251373a4ca35e35c6d1d2740e6c958a85f0a329 (patch)
treed437f349c9fcedc4d1b3ffc8cb1a392f6df40365 /src/util/integer_cln_imp.h
parentb9082ab783d0c11e369b3f3f341d4da3f4300c6f (diff)
Added assertions to the CLN implementation of Integer for getLong() and getUnsignedLong().
Diffstat (limited to 'src/util/integer_cln_imp.h')
-rw-r--r--src/util/integer_cln_imp.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util/integer_cln_imp.h b/src/util/integer_cln_imp.h
index 6e2ca3500..b7a35fee8 100644
--- a/src/util/integer_cln_imp.h
+++ b/src/util/integer_cln_imp.h
@@ -29,6 +29,7 @@
#include <cln/integer.h>
#include <cln/input.h>
#include <cln/integer_io.h>
+#include <limits>
#include "util/Assert.h"
@@ -245,12 +246,14 @@ public:
//friend std::ostream& operator<<(std::ostream& os, const Integer& n);
long getLong() const {
- // supposed to throw if not representable in type "long"
+ Assert(d_value <= std::numeric_limits<long>::max());
+ Assert(d_value >= std::numeric_limits<long>::min());
return cln::cl_I_to_long(d_value);
}
unsigned long getUnsignedLong() const {
- // supposed to throw if not representable in type "unsigned long"
+ Assert(d_value <= std::numeric_limits<unsigned long>::max());
+ Assert(d_value >= std::numeric_limits<unsigned long>::min());
return cln::cl_I_to_ulong(d_value);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback