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 22, 2019
1 parent a62cce2 commit 7c7b5cd
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 @@ -130,7 +130,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 @@ -139,7 +139,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 7c7b5cd

Please sign in to comment.