Closed lonerapier closed 2 months ago
use nightly specialisation feature to make field methods default so that it can be overridden
default
impl<const P: usize> const Add for PrimeField<P> { default type Output = Self; default fn add(self, rhs: Self) -> Self { Self { value: (self.value + rhs.value) % Self::ORDER } } }
and then overridden by BinaryField
BinaryField
pub type BinaryField = PrimeField<2>; impl Add for BinaryField { type Output = Self; #[allow(clippy::suspicious_arithmetic_impl)] fn add(self, rhs: Self) -> Self::Output { BinaryField::new(self.value ^ rhs.value) } }
not needed due to #126
use nightly specialisation feature to make field methods
default
so that it can be overriddenand then overridden by
BinaryField