From: Tim King Date: Mon, 31 Oct 2011 21:43:11 +0000 (+0000) Subject: Added assertions to the CLN implementation of Integer for getLong() and getUnsignedLo... X-Git-Tag: cvc5-1.0.0~8396 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9251373a4ca35e35c6d1d2740e6c958a85f0a329;p=cvc5.git Added assertions to the CLN implementation of Integer for getLong() and getUnsignedLong(). --- 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 #include #include +#include #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::max()); + Assert(d_value >= std::numeric_limits::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::max()); + Assert(d_value >= std::numeric_limits::min()); return cln::cl_I_to_ulong(d_value); }