Browse Source

Big integer/binary mem literal support.

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

16
libethereum/Instruction.cpp

@ -585,11 +585,25 @@ 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>();
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>();
++ii;

Loading…
Cancel
Save