aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@gmail.com>2015-02-10 22:43:13 +0800
committerLu Guanqun <guanqun.lu@gmail.com>2015-02-10 23:39:13 +0800
commit11b4e7f7d8cf45be2717bb249cf966788f486ede (patch)
tree4d3005065aa1d9da4affae0ca695ed868352b659 /Types.cpp
parentd307b0914c4425ffbdf312b270a5528868915667 (diff)
downloaddexon-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.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Types.cpp b/Types.cpp
index dcc0738d..5f573a6d 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -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();