use core::ops::{Add, Sub, Shr, Shl, Rem, Mul};
use crate::{BigUInt, property::IsBigInt};
pub mod impls;
pub mod slice;
pub trait WrapAround<Rhs = Self> {
fn wrap(self, rhs: Rhs) -> Self;
}
pub trait BigIntOpsExt
where
Self:
BigIntOps +
Mul<Self, Output = [Self; 2]> + Mul<Self::Dig, Output = (Self, Self::Dig)> +
WrapAround<[Self; 2]> +
PartialEq<[Self; 2]> + PartialOrd<[Self; 2]>
{ }
pub trait BigIntOps
where
Self:
Sized + Copy +
IsBigInt +
Add<Output = (Self, Self::Dig)> + Add<Self::Dig, Output = (Self, Self::Dig)> +
Sub<Output = (Self, Self::Dig)> + Sub<Self::Dig, Output = (Self, Self::Dig)> +
Shr<usize, Output = Self> +
Shl<usize, Output = Self> +
Rem<Output = Self> +
Ord + Eq
{ }
impl<T: Copy, const LEN: usize> BigIntOps for BigUInt<T, LEN>
where
Self:
IsBigInt +
Add<Output = (Self, Self::Dig)> + Add<Self::Dig, Output = (Self, Self::Dig)> +
Sub<Output = (Self, Self::Dig)> + Sub<Self::Dig, Output = (Self, Self::Dig)> +
Shr<usize, Output = Self> +
Shr<usize, Output = Self> +
Shl<usize, Output = Self> +
Rem<Output = Self> +
Ord + Eq,
{ }
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]>
{ }