fixed: PartialOrd, Ord

This commit is contained in:
Quaternions 2024-08-27 14:23:38 -07:00
parent 047451d247
commit 4ce5c045a8

View File

@ -27,6 +27,17 @@ impl<const CHUNKS:usize,Frac> PartialEq for Fixed<CHUNKS,Frac>{
}
impl<const CHUNKS:usize,Frac> Eq for Fixed<CHUNKS,Frac>{}
impl<const CHUNKS:usize,Frac> PartialOrd for Fixed<CHUNKS,Frac>{
fn partial_cmp(&self,other:&Self)->Option<std::cmp::Ordering>{
self.bits.partial_cmp(&other.bits)
}
}
impl<const CHUNKS:usize,Frac> Ord for Fixed<CHUNKS,Frac>{
fn cmp(&self,other:&Self)->std::cmp::Ordering{
self.bits.cmp(&other.bits)
}
}
impl<const CHUNKS:usize,Frac> std::ops::Neg for Fixed<CHUNKS,Frac>{
type Output=Self;
fn neg(self)->Self{