mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adding fixes for signedness warnings in test/tools/yulInterpreter
This commit is contained in:
parent
97cb091ada
commit
1ee6c49028
@ -48,10 +48,10 @@ u256 readZeroExtended(bytes const& _data, u256 const& _offset)
|
|||||||
if (_offset >= _data.size())
|
if (_offset >= _data.size())
|
||||||
return 0;
|
return 0;
|
||||||
else if (_offset + 32 <= _data.size())
|
else if (_offset + 32 <= _data.size())
|
||||||
return *reinterpret_cast<h256 const*>(_data.data() + size_t(_offset));
|
return *reinterpret_cast<h256 const*>(_data.data() + static_cast<size_t>(_offset));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t off = size_t(_offset);
|
size_t off = static_cast<size_t>(_offset);
|
||||||
u256 val;
|
u256 val;
|
||||||
for (size_t i = 0; i < 32; ++i)
|
for (size_t i = 0; i < 32; ++i)
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ u256 EVMInstructionInterpreter::eval(
|
|||||||
using evmasm::Instruction;
|
using evmasm::Instruction;
|
||||||
|
|
||||||
auto info = instructionInfo(_instruction);
|
auto info = instructionInfo(_instruction);
|
||||||
yulAssert(size_t(info.args) == _arguments.size(), "");
|
yulAssert(static_cast<size_t>(info.args) == _arguments.size(), "");
|
||||||
|
|
||||||
auto const& arg = _arguments;
|
auto const& arg = _arguments;
|
||||||
switch (_instruction)
|
switch (_instruction)
|
||||||
@ -442,7 +442,7 @@ u256 EVMInstructionInterpreter::evalBuiltin(BuiltinFunctionForEVM const& _fun, c
|
|||||||
m_state.memory,
|
m_state.memory,
|
||||||
m_state.code,
|
m_state.code,
|
||||||
size_t(_arguments.at(0)),
|
size_t(_arguments.at(0)),
|
||||||
size_t(_arguments.at(1) & size_t(-1)),
|
size_t(_arguments.at(1) & numeric_limits<size_t>::max()),
|
||||||
size_t(_arguments.at(2))
|
size_t(_arguments.at(2))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -87,9 +87,9 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
|||||||
copyZeroExtended(
|
copyZeroExtended(
|
||||||
m_state.memory,
|
m_state.memory,
|
||||||
m_state.code,
|
m_state.code,
|
||||||
size_t(_arguments.at(0)),
|
static_cast<size_t>(_arguments.at(0)),
|
||||||
size_t(_arguments.at(1) & size_t(-1)),
|
static_cast<size_t>(_arguments.at(1) & numeric_limits<size_t>::max()),
|
||||||
size_t(_arguments.at(2))
|
static_cast<size_t>(_arguments.at(2))
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ void InterpreterState::dumpTraceAndState(ostream& _out) const
|
|||||||
_out << "Memory dump:\n";
|
_out << "Memory dump:\n";
|
||||||
map<u256, u256> words;
|
map<u256, u256> words;
|
||||||
for (auto const& [offset, value]: memory)
|
for (auto const& [offset, value]: memory)
|
||||||
words[(offset / 0x20) * 0x20] |= u256(uint32_t(value)) << (256 - 8 - 8 * size_t(offset % 0x20));
|
words[(offset / 0x20) * 0x20] |= u256(uint32_t(value)) << (256 - 8 - 8 * static_cast<size_t>(offset % 0x20));
|
||||||
for (auto const& [offset, value]: words)
|
for (auto const& [offset, value]: words)
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
_out << " " << std::uppercase << std::hex << std::setw(4) << offset << ": " << h256(value).hex() << endl;
|
_out << " " << std::uppercase << std::hex << std::setw(4) << offset << ": " << h256(value).hex() << endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user