use bnum::types::{I256,I512}; use fixed::{FixedI64,FixedI128}; use typenum::{Sum, Unsigned}; use typenum::consts::{U32,U64,U96,U128,U160,U192,U224,U256}; pub trait WideMul{ type Output; fn wide_mul(self,rhs:Rhs)->Self::Output; } pub struct Fixed{ bits:Int, phantom:std::marker::PhantomData, } pub type FixedI256=Fixed; pub type FixedI512=Fixed; impl WideMul> for FixedI128 where A:std::ops::Add, B:Unsigned, { type Output=FixedI256>; fn wide_mul(self,rhs:FixedI128)->Self::Output{ FixedI256{ bits:I256::from(self.to_bits())*I256::from(rhs.to_bits()), phantom:std::marker::PhantomData, } } }