diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2015-02-10 22:43:13 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2015-02-10 23:39:13 +0800 |
commit | 11b4e7f7d8cf45be2717bb249cf966788f486ede (patch) | |
tree | 4d3005065aa1d9da4affae0ca695ed868352b659 /Types.cpp | |
parent | d307b0914c4425ffbdf312b270a5528868915667 (diff) | |
download | dexon-solidity-11b4e7f7d8cf45be2717bb249cf966788f486ede.tar.gz dexon-solidity-11b4e7f7d8cf45be2717bb249cf966788f486ede.tar.zst dexon-solidity-11b4e7f7d8cf45be2717bb249cf966788f486ede.zip |
small fixes per chris's comments
Diffstat (limited to 'Types.cpp')
-rw-r--r-- | Types.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -26,6 +26,8 @@ #include <libsolidity/Types.h> #include <libsolidity/AST.h> +#include <limits> + using namespace std; namespace dev @@ -322,13 +324,11 @@ TypePointer IntegerConstantType::binaryOperatorResult(Token::Value _operator, Ty break; case Token::Exp: if (other.m_value < 0) - BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("exponent can't be negative")); + return TypePointer(); + else if (other.m_value > std::numeric_limits<unsigned int>::max()) + return TypePointer(); else - { - value = boost::multiprecision::powm(m_value, other.m_value, bigint(2) << 256); - if (value >= (bigint(1) << 256)) - BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("exp result overflowed")); - } + value = boost::multiprecision::pow(m_value, other.m_value.convert_to<unsigned int>()); break; default: return TypePointer(); |