Browse Source

Big integer/binary mem literal support.

cl-refactor
Gav Wood 11 years ago
parent
commit
4dec750161
  1. 20
      libethereum/Instruction.cpp

20
libethereum/Instruction.cpp

@ -585,10 +585,24 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
else if (ii >= 2 && !i.tag() && i.which() == sp::utree_type::any_type)
{
bigint bi = *i.get<bigint*>();
if (bi < 0 || bi > bigint(u256(0) - 1))
if (bi < 0)
error<IntegerOutOfRange>();
data.resize(data.size() + 32);
*(h256*)(&data.back() - 31) = (u256)bi;
else if (bi > bigint(u256(0) - 1))
{
if (ii == 2 && _t.size() == 3)
{
// One big int - allow it as hex.
data.resize(bytesRequired(bi));
toBigEndian(bi, data);
}
else
error<IntegerOutOfRange>();
}
else
{
data.resize(data.size() + 32);
*(h256*)(&data.back() - 31) = (u256)bi;
}
}
else if (ii)
error<InvalidLiteral>();

Loading…
Cancel
Save