Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

o1vm/riscv32: remove unused divmod_signed #2802

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading