you can add
This commit is contained in:
parent
114b2725ea
commit
d38d103399
@ -27,6 +27,16 @@ impl<Int:PartialEq,Frac> PartialEq for Fixed<Int,Frac>{
|
|||||||
}
|
}
|
||||||
impl<Int:Eq,Frac> Eq for Fixed<Int,Frac>{}
|
impl<Int:Eq,Frac> Eq for Fixed<Int,Frac>{}
|
||||||
|
|
||||||
|
impl<Int:std::ops::Add<Output=Int>,Frac> std::ops::Add for Fixed<Int,Frac>{
|
||||||
|
type Output=Self;
|
||||||
|
fn add(self,rhs:Self)->Self::Output{
|
||||||
|
Self{
|
||||||
|
bits:self.bits+rhs.bits,
|
||||||
|
phantom:std::marker::PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait WideMul<Rhs=Self>{
|
pub trait WideMul<Rhs=Self>{
|
||||||
type Output;
|
type Output;
|
||||||
fn wide_mul(self,rhs:Rhs)->Self::Output;
|
fn wide_mul(self,rhs:Rhs)->Self::Output;
|
||||||
|
@ -19,6 +19,12 @@ fn wide_int64() {
|
|||||||
assert_eq!(w3,Planar64Wide3::from((3i128*2).pow(4)));
|
assert_eq!(w3,Planar64Wide3::from((3i128*2).pow(4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn you_can_add_numbers(){
|
||||||
|
let a=Planar64Wide3::from((3i128*2).pow(4));
|
||||||
|
assert_eq!(a+a,Planar64Wide3::from((3i128*2).pow(4)*2))
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn wide_vec3(){
|
fn wide_vec3(){
|
||||||
let v=Vector3::from_value(Planar64::from(3));
|
let v=Vector3::from_value(Planar64::from(3));
|
||||||
|
Loading…
Reference in New Issue
Block a user