pub trait BigIntOpsExtwhere
    Self: BigIntOps + Mul<Self, Output = [Self; 2]> + Mul<Self::Dig, Output = (Self, Self::Dig)> + WrapAround<[Self; 2]> + PartialEq<[Self; 2]> + PartialOrd<[Self; 2]>,{ }
Expand description

This trait requires bigint to implement methods for multiplication.

Due to restrictions on rust type system, it’s difficult for us to express something like

Self: Mul<Output = impl BigUIntProperties<DIG_LEN == 2 * <Self as BigUIntProperties>::DIG_LEN> && Dig == <Self as BigUIntProperties>::Dig>

So instead of implementing a multiplication that returns one biguint with twice of self’s length, we return two biguints representing the higher digs and lower digs seperatly.

This trait requires biguint to implement this kind of multiplication, and to use the return convinently, we should also implement a mod method to convert two biguints into one by modding one biguint, which is useful when we are dealing with biguint mul-mod or exp-mod arithmetics.

Implementors§

source§

impl<T: Copy, const LEN: usize> BigIntOpsExt for BigUInt<T, LEN>where Self: BigIntOps + Mul<Output = [Self; 2]> + Mul<Self::Dig, Output = (Self, Self::Dig)> + WrapAround<[Self; 2]> + PartialEq<[Self; 2]> + PartialOrd<[Self; 2]>,