diff --git a/lib/evmone/instructions.hpp b/lib/evmone/instructions.hpp index 10fb59cb76..d882a7b4c1 100644 --- a/lib/evmone/instructions.hpp +++ b/lib/evmone/instructions.hpp @@ -122,7 +122,7 @@ inline evmc_status_code exp(ExecutionState& state) noexcept auto& exponent = state.stack.top(); const auto exponent_significant_bytes = - static_cast(intx::count_significant_words(exponent)); + static_cast(intx::count_significant_bytes(exponent)); const auto exponent_cost = state.rev >= EVMC_SPURIOUS_DRAGON ? 50 : 10; const auto additional_cost = exponent_significant_bytes * exponent_cost; if ((state.gas_left -= additional_cost) < 0) @@ -161,21 +161,14 @@ inline void gt(Stack& stack) noexcept inline void slt(Stack& stack) noexcept { - // TODO: Move this to intx. const auto x = stack.pop(); - auto& y = stack[0]; - const auto x_neg = x.hi.hi >> 63; - const auto y_neg = y.hi.hi >> 63; - y = ((x_neg ^ y_neg) != 0) ? x_neg : x < y; + stack[0] = slt(x, stack[0]); } inline void sgt(Stack& stack) noexcept { const auto x = stack.pop(); - auto& y = stack[0]; - const auto x_neg = x.hi.hi >> 63; - const auto y_neg = y.hi.hi >> 63; - y = ((x_neg ^ y_neg) != 0) ? y_neg : y < x; + stack[0] = slt(stack[0], x); } inline void eq(Stack& stack) noexcept