Skip to content

Commit

Permalink
Remove unused and untested u128/i128 implementations (scroll-tech…
Browse files Browse the repository at this point in the history
…#737)

Extracted from scroll-tech#736 for ease of
review.
  • Loading branch information
matthiasgoergens authored and 10to4 committed Dec 12, 2024
1 parent 5077eb1 commit c07fa00
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions ceno_zkvm/src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,17 +601,17 @@ macro_rules! mixed_binop_instances {
mixed_binop_instances!(
Add,
add,
(u8, u16, u32, u64, usize, i8, i16, i32, i64, i128, isize)
(u8, u16, u32, u64, usize, i8, i16, i32, i64, isize)
);
mixed_binop_instances!(
Sub,
sub,
(u8, u16, u32, u64, usize, i8, i16, i32, i64, i128, isize)
(u8, u16, u32, u64, usize, i8, i16, i32, i64, isize)
);
mixed_binop_instances!(
Mul,
mul,
(u8, u16, u32, u64, usize, i8, i16, i32, i64, i128, isize)
(u8, u16, u32, u64, usize, i8, i16, i32, i64, isize)
);

impl<E: ExtensionField> Mul for Expression<E> {
Expand Down Expand Up @@ -901,14 +901,6 @@ macro_rules! impl_from_unsigned {
}
impl_from_unsigned!(u8, u16, u32, u64, usize, RAMType, InsnKind);

// Implement From trait for u128 separately since it requires explicit reduction
impl<F: SmallField, E: ExtensionField<BaseField = F>> From<u128> for Expression<E> {
fn from(value: u128) -> Self {
let reduced = value.rem_euclid(F::MODULUS_U64 as u128) as u64;
Expression::Constant(F::from(reduced))
}
}

// Implement From trait for signed types
macro_rules! impl_from_signed {
($($t:ty),*) => {
Expand All @@ -922,7 +914,7 @@ macro_rules! impl_from_signed {
)*
};
}
impl_from_signed!(i8, i16, i32, i64, i128, isize);
impl_from_signed!(i8, i16, i32, i64, isize);

impl<E: ExtensionField> Display for Expression<E> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand Down

0 comments on commit c07fa00

Please sign in to comment.