Adding fixes for signedness warnings in test/tools/yulInterpreter

This commit is contained in:
Djordje Mijovic 2020-06-02 15:46:37 +02:00 committed by Daniel Kirchner
parent 97cb091ada
commit 1ee6c49028
3 changed files with 8 additions and 8 deletions

View File

@ -48,10 +48,10 @@ u256 readZeroExtended(bytes const& _data, u256 const& _offset)
if (_offset >= _data.size())
return 0;
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
{
size_t off = size_t(_offset);
size_t off = static_cast<size_t>(_offset);
u256 val;
for (size_t i = 0; i < 32; ++i)
{
@ -88,7 +88,7 @@ u256 EVMInstructionInterpreter::eval(
using evmasm::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;
switch (_instruction)
@ -442,7 +442,7 @@ u256 EVMInstructionInterpreter::evalBuiltin(BuiltinFunctionForEVM const& _fun, c
m_state.memory,
m_state.code,
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))
);
}

View File

@ -87,9 +87,9 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
copyZeroExtended(
m_state.memory,
m_state.code,
size_t(_arguments.at(0)),
size_t(_arguments.at(1) & size_t(-1)),
size_t(_arguments.at(2))
static_cast<size_t>(_arguments.at(0)),
static_cast<size_t>(_arguments.at(1) & numeric_limits<size_t>::max()),
static_cast<size_t>(_arguments.at(2))
);
return 0;
}

View File

@ -54,7 +54,7 @@ void InterpreterState::dumpTraceAndState(ostream& _out) const
_out << "Memory dump:\n";
map<u256, u256> words;
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)
if (value != 0)
_out << " " << std::uppercase << std::hex << std::setw(4) << offset << ": " << h256(value).hex() << endl;