Skip to content

Commit

Permalink
Merge pull request #2802 from o1-labs/dw/o1vm/riscv32/remove-unused-d…
Browse files Browse the repository at this point in the history
…ivmod-signed

o1vm/riscv32: remove unused divmod_signed
  • Loading branch information
dannywillems authored Dec 2, 2024
2 parents 06b07c2 + 77a50c4 commit 4326735
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 47 deletions.
13 changes: 0 additions & 13 deletions o1vm/src/interpreters/riscv32im/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,19 +371,6 @@ impl<Fp: Field> InterpreterEnv for Env<Fp> {
self.variable(position)
}

unsafe fn divmod_signed(
&mut self,
_x: &Self::Variable,
_y: &Self::Variable,
position_quotient: Self::Position,
position_remainder: Self::Position,
) -> (Self::Variable, Self::Variable) {
(
self.variable(position_quotient),
self.variable(position_remainder),
)
}

unsafe fn divmod(
&mut self,
_x: &Self::Variable,
Expand Down
16 changes: 0 additions & 16 deletions o1vm/src/interpreters/riscv32im/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,22 +1285,6 @@ pub trait InterpreterEnv {
position: Self::Position,
) -> Self::Variable;

/// Returns `(x / y, x % y)`, storing the results in `position_quotient` and
/// `position_remainder` respectively.
///
/// # Safety
///
/// There are no constraints on the returned values; callers must manually add constraints to
/// ensure that the pair of returned values correspond to the given values `x` and `y`, and
/// that they fall within the desired range.
unsafe fn divmod_signed(
&mut self,
x: &Self::Variable,
y: &Self::Variable,
position_quotient: Self::Position,
position_remainder: Self::Position,
) -> (Self::Variable, Self::Variable);

/// Returns `(x / y, x % y)`, storing the results in `position_quotient` and
/// `position_remainder` respectively.
///
Expand Down
18 changes: 0 additions & 18 deletions o1vm/src/interpreters/riscv32im/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,24 +529,6 @@ impl<Fp: Field> InterpreterEnv for Env<Fp> {
res
}

unsafe fn divmod_signed(
&mut self,
x: &Self::Variable,
y: &Self::Variable,
position_quotient: Self::Position,
position_remainder: Self::Position,
) -> (Self::Variable, Self::Variable) {
let x: u32 = (*x).try_into().unwrap();
let y: u32 = (*y).try_into().unwrap();
let q = ((x as i32) / (y as i32)) as u32;
let r = ((x as i32) % (y as i32)) as u32;
let q = q as u64;
let r = r as u64;
self.write_column(position_quotient, q);
self.write_column(position_remainder, r);
(q, r)
}

unsafe fn divmod(
&mut self,
x: &Self::Variable,
Expand Down

0 comments on commit 4326735

Please sign in to comment.