diff options
author | Clark Barrett <barrett@cs.nyu.edu> | 2016-08-19 16:39:43 -0700 |
---|---|---|
committer | Clark Barrett <barrett@cs.nyu.edu> | 2016-08-19 16:39:43 -0700 |
commit | d28f9f38ead8ec010a38e021f92d5de95261afc9 (patch) | |
tree | ca1cc88b87afc9bb40bf70cb88a3996646e2a5bc /src/util/integer_cln_imp.cpp | |
parent | 36cfaab5caa86773e47a8cca8f4d8c0d5edec99f (diff) |
Added fitsSignedLong and fitsUnsignedLong
Diffstat (limited to 'src/util/integer_cln_imp.cpp')
-rw-r--r-- | src/util/integer_cln_imp.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/integer_cln_imp.cpp b/src/util/integer_cln_imp.cpp index 0064f2904..aa6cb03af 100644 --- a/src/util/integer_cln_imp.cpp +++ b/src/util/integer_cln_imp.cpp @@ -40,6 +40,10 @@ signed long Integer::s_slowSignedIntMax = (signed long) std::numeric_limits<sig unsigned int Integer::s_fastUnsignedIntMax = (1<<29)-1; unsigned long Integer::s_slowUnsignedIntMax = (unsigned long) std::numeric_limits<unsigned int>::max(); +unsigned long Integer::s_signedLongMin = std::numeric_limits<signed long>::min(); +unsigned long Integer::s_signedLongMax = std::numeric_limits<signed long>::max(); +unsigned long Integer::s_unsignedLongMax = std::numeric_limits<unsigned long>::max(); + Integer Integer::oneExtend(uint32_t size, uint32_t amount) const { DebugCheckArgument((*this) < Integer(1).multiplyByPow2(size), size); cln::cl_byte range(amount, size); @@ -133,4 +137,12 @@ unsigned int Integer::getUnsignedInt() const { return cln::cl_I_to_uint(d_value); } +bool Integer::fitsSignedLong() const { + return d_value <= s_signedLongMax && d_value >= s_signedLongMin; +} + +bool Integer::fitsUnsignedLong() const { + return sgn() >= 0 && d_value <= s_unsignedLongMax; +} + } /* namespace CVC4 */ |