From 4ce5c045a805d46ad0430ac6551020684bd31084 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 27 Aug 2024 14:23:38 -0700 Subject: [PATCH] fixed: PartialOrd, Ord --- fixed_wide/src/fixed.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fixed_wide/src/fixed.rs b/fixed_wide/src/fixed.rs index 8b16620..fdda80a 100644 --- a/fixed_wide/src/fixed.rs +++ b/fixed_wide/src/fixed.rs @@ -27,6 +27,17 @@ impl PartialEq for Fixed{ } impl Eq for Fixed{} +impl PartialOrd for Fixed{ + fn partial_cmp(&self,other:&Self)->Option{ + self.bits.partial_cmp(&other.bits) + } +} +impl Ord for Fixed{ + fn cmp(&self,other:&Self)->std::cmp::Ordering{ + self.bits.cmp(&other.bits) + } +} + impl std::ops::Neg for Fixed{ type Output=Self; fn neg(self)->Self{