Skip to content

Commit

Permalink
chore(interpreter): rename wrapping_* opcodes (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Apr 16, 2024
1 parent f4f4745 commit 72356e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions crates/interpreter/src/instructions/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ use crate::{
Host, Interpreter,
};

pub fn wrapping_add<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H) {
pub fn add<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H) {
gas!(interpreter, gas::VERYLOW);
pop_top!(interpreter, op1, op2);
*op2 = op1.wrapping_add(*op2);
}

pub fn wrapping_mul<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H) {
pub fn mul<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H) {
gas!(interpreter, gas::LOW);
pop_top!(interpreter, op1, op2);
*op2 = op1.wrapping_mul(*op2);
}

pub fn wrapping_sub<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H) {
pub fn sub<H: Host + ?Sized>(interpreter: &mut Interpreter, _host: &mut H) {
gas!(interpreter, gas::VERYLOW);
pop_top!(interpreter, op1, op2);
*op2 = op1.wrapping_sub(*op2);
Expand Down
6 changes: 3 additions & 3 deletions crates/interpreter/src/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ pub const fn stack_io<const I: u8, const O: u8>(mut opcode: OpCodeInfo) -> OpCod
opcodes! {
0x00 => STOP => control::stop => stack_io<0,0>, terminating;

0x01 => ADD => arithmetic::wrapping_add => stack_io<2, 1>;
0x02 => MUL => arithmetic::wrapping_mul => stack_io<2, 1>;
0x03 => SUB => arithmetic::wrapping_sub => stack_io<2, 1>;
0x01 => ADD => arithmetic::add => stack_io<2, 1>;
0x02 => MUL => arithmetic::mul => stack_io<2, 1>;
0x03 => SUB => arithmetic::sub => stack_io<2, 1>;
0x04 => DIV => arithmetic::div => stack_io<2, 1>;
0x05 => SDIV => arithmetic::sdiv => stack_io<2, 1>;
0x06 => MOD => arithmetic::rem => stack_io<2, 1>;
Expand Down

0 comments on commit 72356e3

Please sign in to comment.