Skip to content

Commit

Permalink
Use addmod()/mulmod() from intx
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Aug 26, 2019
1 parent a8360b6 commit b2bc63a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/evmone/instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b2bc63a

Please sign in to comment.