Skip to content

Commit

Permalink
Remove unused and untested u128/i128 implementations (#737)
Browse files Browse the repository at this point in the history
Extracted from #736 for ease of
review.
  • Loading branch information
matthiasgoergens authored Dec 12, 2024
1 parent 35b352e commit acd2a0c
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 @@ -591,17 +591,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 @@ -840,14 +840,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 @@ -861,7 +853,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 acd2a0c

Please sign in to comment.