From 4a4f0834435300bc8da4107779e0d3214f312152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= <chfast@gmail.com> Date: Wed, 16 Jun 2021 13:12:44 +0200 Subject: [PATCH] Update instructions implementation --- lib/evmone/instructions.hpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/evmone/instructions.hpp b/lib/evmone/instructions.hpp index 10fb59cb7..d882a7b4c 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<int>(intx::count_significant_words<uint8_t>(exponent)); + static_cast<int>(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