From b2bc63a8479d1829557fe78b73c9278659e47339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 21 Aug 2019 21:25:05 +0200 Subject: [PATCH] Use addmod()/mulmod() from intx --- lib/evmone/instructions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/evmone/instructions.cpp b/lib/evmone/instructions.cpp index 6894604d34..7ba63d9825 100644 --- a/lib/evmone/instructions.cpp +++ b/lib/evmone/instructions.cpp @@ -129,7 +129,7 @@ void op_addmod(execution_state& state, instr_argument) noexcept const auto y = state.stack.pop(); auto& m = state.stack.top(); - m = m != 0 ? ((uint512{x} + uint512{y}) % uint512{m}).lo : 0; + m = m != 0 ? addmod(x, y, m) : 0; } void op_mulmod(execution_state& state, instr_argument) noexcept @@ -138,7 +138,7 @@ void op_mulmod(execution_state& state, instr_argument) noexcept const auto y = state.stack.pop(); auto& m = state.stack.top(); - m = m != 0 ? ((uint512{x} * uint512{y}) % uint512{m}).lo : 0; + m = m != 0 ? mulmod(x, y, m) : 0; } void op_exp(execution_state& state, instr_argument) noexcept