Skip to content

Commit 27453a8

Browse files
committed
refactor: use new roaring64_bitmap_contains_range_closed function for intersect_with_range
1 parent 3a51ad3 commit 27453a8

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

croaring/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ criterion = { version = "0.8", features = ["html_reports"] }
3030
[dependencies]
3131
# Support for allocators that use allocator-api2
3232
allocator-api2 = { version = "0.4.0", optional = true, default-features = false, features = ["alloc"] }
33-
ffi = { package = "croaring-sys", path = "../croaring-sys", version = "4.7.0" }
33+
ffi = { package = "croaring-sys", path = "../croaring-sys", version = "4.7.1" }
3434

3535
[[bench]]
3636
name = "benches"

croaring/src/bitmap64/imp.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -590,24 +590,9 @@ impl Bitmap64 {
590590
#[must_use]
591591
#[doc(alias = "roaring64_bitmap_contains_range")]
592592
pub fn contains_range<R: RangeBounds<u64>>(&self, range: R) -> bool {
593-
let Some(exclusive_range) = range_to_exclusive(range) else {
594-
return true;
595-
};
596-
self._contains_range(exclusive_range)
597-
}
593+
let (start, last) = range_to_inclusive(range);
598594

599-
#[inline]
600-
fn _contains_range(&self, exclusive_range: ExclusiveRangeRes) -> bool {
601-
let ExclusiveRangeRes {
602-
start,
603-
end,
604-
needs_max,
605-
} = exclusive_range;
606-
607-
if needs_max && !self.contains(u64::MAX) {
608-
return false;
609-
}
610-
unsafe { ffi::roaring64_bitmap_contains_range(self.raw.as_ptr(), start, end) }
595+
unsafe { ffi::roaring64_bitmap_contains_range_closed(self.raw.as_ptr(), start, last) }
611596
}
612597

613598
/// Selects the element at index 'rank' where the smallest element is at index 0

0 commit comments

Comments
 (0)