From 16c8f2c127974a106ef6a64f54758003d01b19da Mon Sep 17 00:00:00 2001 From: Mingzhuo Yin Date: Wed, 21 Feb 2024 10:19:51 +0800 Subject: [PATCH] fix invalid cmp Signed-off-by: Mingzhuo Yin --- crates/base/src/vector/binary.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/base/src/vector/binary.rs b/crates/base/src/vector/binary.rs index 40f6f3390..28bc6578e 100644 --- a/crates/base/src/vector/binary.rs +++ b/crates/base/src/vector/binary.rs @@ -53,7 +53,15 @@ impl<'a> From> for Vec { impl<'a> Ord for BinaryVecRef<'a> { fn cmp(&self, other: &Self) -> std::cmp::Ordering { assert_eq!(self.dims, other.dims); - self.data.cmp(other.data).reverse() + for (&l, &r) in self.data.iter().zip(other.data.iter()) { + let l = l.reverse_bits(); + let r = r.reverse_bits(); + match l.cmp(&r) { + std::cmp::Ordering::Equal => {} + x => return x, + } + } + std::cmp::Ordering::Equal } }