Skip to content

Commit

Permalink
less
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 committed Mar 28, 2024
1 parent a0b94ff commit 13205ef
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions vortex-array/src/compute/search_sorted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ impl<S: IndexOrd<usize, T> + Len + ?Sized, T> SearchSorted<T, usize> for S {
}
}

impl<T: Array> IndexOrd<usize, Scalar> for T {
fn index_cmp(&self, idx: &usize, elem: &Scalar) -> Option<Ordering> {
let scalar_a = scalar_at(self, *idx).ok()?;
scalar_a.partial_cmp(elem)
}
}

impl IndexOrd<usize, Scalar> for &dyn Array {
fn index_cmp(&self, idx: &usize, elem: &Scalar) -> Option<Ordering> {
let scalar_a = scalar_at(*self, *idx).ok()?;
Expand All @@ -134,13 +127,8 @@ impl IndexOrd<usize, Scalar> for &dyn Array {

impl<T: PartialOrd> IndexOrd<usize, T> for [T] {
fn index_cmp(&self, idx: &usize, elem: &T) -> Option<Ordering> {
self[*idx].partial_cmp(elem)
}
}

impl<T: Array> Len for T {
fn len(&self) -> usize {
T::len(self)
// SAFETY: Used in search_sorted_by same as the standard library. The search_sorted ensures idx is in bounds
unsafe { self.get_unchecked(*idx) }.partial_cmp(elem)
}
}

Expand Down

0 comments on commit 13205ef

Please sign in to comment.