pub trait IntoWide<T = Self> {
fn to_wide(&self) -> T;
fn zero_wide() -> T;
}
pub trait ReduceWide<T = Self> {
fn reduce_mod_order(a: T) -> Self;
}
pub trait MulAccReduce<Lhs = Self, Rhs = Self>:
IntoWide<Self::WideType> + ReduceWide<Self::WideType>
{
type WideType;
fn mul_acc(acc: &mut Self::WideType, a: Lhs, b: Rhs);
#[inline]
fn to_wide(&self) -> Self::WideType {
<Self as IntoWide<Self::WideType>>::to_wide(self)
}
#[inline]
fn zero_wide() -> Self::WideType {
<Self as IntoWide<Self::WideType>>::zero_wide()
}
}
pub trait AccReduce<T = Self>: ReduceWide<Self::WideType> + IntoWide<Self::WideType> {
type WideType;
fn acc(acc: &mut Self::WideType, a: T);
#[inline]
fn to_wide(&self) -> Self::WideType {
<Self as IntoWide<Self::WideType>>::to_wide(self)
}
#[inline]
fn zero_wide() -> Self::WideType {
<Self as IntoWide<Self::WideType>>::zero_wide()
}
}