Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pyroaring/abstract_bitmap.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,13 @@ cdef class AbstractBitMap:
return index

cdef uint32_t _get_elt(self, int64_t index) except? 0:
cdef uint64_t s_index = self._shift_index(index)
cdef uint32_t elt
if 0 <= index <= 0xFFFFFFFF:
# select reports out-of-range ranks itself: skip len(), which scans every container.
if croaring.roaring_bitmap_select(self._c_bitmap, <uint32_t>index, &elt):
return elt
raise IndexError('Index out of bound')
cdef uint64_t s_index = self._shift_index(index)
cdef bool valid = croaring.roaring_bitmap_select(self._c_bitmap, s_index, &elt)
if not valid:
raise ValueError('Invalid rank')
Expand Down Expand Up @@ -1208,8 +1213,13 @@ cdef class AbstractBitMap64:
return index

cdef uint64_t _get_elt(self, int64_t index) except? 0:
cdef uint64_t s_index = self._shift_index(index)
cdef uint64_t elt
if index >= 0:
# select reports out-of-range ranks itself: skip len(), which scans every container.
if croaring.roaring64_bitmap_select(self._c_bitmap, <uint64_t>index, &elt):
return elt
raise IndexError('Index out of bound')
cdef uint64_t s_index = self._shift_index(index)
cdef bool valid = croaring.roaring64_bitmap_select(self._c_bitmap, s_index, &elt)
if not valid:
raise ValueError('Invalid rank')
Expand Down
2 changes: 1 addition & 1 deletion pyroaring/croaring_version.pxi
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__croaring_version__ = "v5.2.2"
__croaring_version__ = "v5.5.5"
Loading
Loading