diff --git a/fixed_wide/src/fixed.rs b/fixed_wide/src/fixed.rs index 79f7579..df6b957 100644 --- a/fixed_wide/src/fixed.rs +++ b/fixed_wide/src/fixed.rs @@ -52,6 +52,15 @@ impl PartialEq for Fixed{ self.bits.eq(&other.bits) } } +impl PartialEq for Fixed +where + T:Copy, + BInt:::From, +{ + fn eq(&self,&other:&T)->bool{ + self.bits.eq(&other.into()) + } +} impl Eq for Fixed{} impl PartialOrd for Fixed{ @@ -59,6 +68,15 @@ impl PartialOrd for Fixed{ self.bits.partial_cmp(&other.bits) } } +impl PartialOrd for Fixed + where + T:Copy, + BInt:::From, +{ + fn partial_cmp(&self,&other:&T)->Option{ + self.bits.partial_cmp(&other.into()) + } +} impl Ord for Fixed{ fn cmp(&self,other:&Self)->std::cmp::Ordering{ self.bits.cmp(&other.bits)