Skip to content

Commit

Permalink
Add support for 64-bit bitmaps
Browse files Browse the repository at this point in the history
This commit adds classes BitMap64 and FrozenBitMap64 that can contain integers from 0 to 2**64-1 (instead of 2**32-1).

---------

Co-authored-by: buckwheat445 <[email protected]>
  • Loading branch information
Ezibenroc and buckwheat445 authored Aug 24, 2024
1 parent ccbf749 commit b54769b
Show file tree
Hide file tree
Showing 12 changed files with 14,883 additions and 7,873 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ jobs:
run: |
pip install --upgrade pip
pip install tox
- name: Local build and tests
- name: Local build and tests (32 bits roaring bitmaps)
env:
HYPOTHESIS_PROFILE: ci
ROARING_BITSIZE: 32
run: |
tox
- name: Local build and tests (64 bits roaring bitmaps)
env:
HYPOTHESIS_PROFILE: ci
ROARING_BITSIZE: 64
run: |
tox
216 changes: 216 additions & 0 deletions pyroaring/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,219 @@ class BitMap(AbstractBitMap):

def remove_range(self, range_start: int, range_end: int) -> None:
...

class AbstractBitMap64:
def __init__(self, values: Iterable[int] | None = None, copy_on_write: bool = False, optimize: bool = True) -> None:
...

@property
def copy_on_write(self) -> bool:
...

def run_optimize(self) -> bool:
...

def shrink_to_fit(self) -> int:
...

def __contains__(self, value: int) -> bool:
...

def __bool__(self) -> bool:
...

def __len__(self) -> int:
...

def __lt__(self, other: AbstractBitMap64) -> bool:
...

def __le__(self, other: AbstractBitMap64) -> bool:
...

def __eq__(self, other: object) -> bool:
...

def __ne__(self, other: object) -> bool:
...

def __gt__(self, other: AbstractBitMap64) -> bool:
...

def __ge__(self, other: AbstractBitMap64) -> bool:
...

def contains_range(self, range_start: int, range_end: int) -> bool:
...

def range_cardinality(self, range_start: int, range_end: int) -> int:
...

def iter_equal_or_larger(self, val: int) -> Iterator[int]:
...

def __iter__(self) -> Iterator[int]:
...

def flip(self, start: int, end: int) -> Self:
...

def shift(self, offset: int) -> Self:
...

def copy(self) -> Self:
...

def isdisjoint(self, other: AbstractBitMap64) -> bool:
...

def issubset(self, other: AbstractBitMap64) -> bool:
...

def issuperset(self, other: AbstractBitMap64) -> bool:
...

def difference(self, *bitmaps: AbstractBitMap64) -> Self:
...

def symmetric_difference(self, other: AbstractBitMap64) -> Self:
...

def union(self, *bitmaps: AbstractBitMap64) -> Self:
...

def intersection(self, *bitmaps: AbstractBitMap64) -> Self:
...

def __or__(self, other: AbstractBitMap64) -> Self:
...

def __and__(self, other: AbstractBitMap64) -> Self:
...

def __xor__(self, other: AbstractBitMap64) -> Self:
...

def __sub__(self, other: AbstractBitMap64) -> Self:
...

def union_cardinality(self, other: AbstractBitMap64) -> int:
...

def intersection_cardinality(self, other: AbstractBitMap64) -> int:
...

def difference_cardinality(self, other: AbstractBitMap64) -> int:
...

def symmetric_difference_cardinality(self, other: AbstractBitMap64) -> int:
...

def intersect(self, other: AbstractBitMap64) -> bool:
...

def jaccard_index(self, other: AbstractBitMap64) -> float:
...

def get_statistics(self) -> _Statistics:
...

def min(self) -> int:
...

def max(self) -> int:
...

def rank(self, value: int) -> int:
...

def next_set_bit(self, value: int) -> int:
...

@overload
def __getitem__(self, value: int) -> int:
...

@overload
def __getitem__(self, value: slice) -> Self:
...

def serialize(self) -> bytes:
...

@classmethod
def deserialize(cls, buff: bytes) -> Self:
...

def __getstate__(self) -> bytes:
...

def __setstate__(self, state: bytes) -> Self:
...

def __sizeof__(self) -> int:
...

def to_array(self) -> array.array[int]:
...


class FrozenBitMap64(AbstractBitMap64):
def __hash__(self) -> int:
...


class BitMap64(AbstractBitMap64):
def add(self, value: int) -> None:
...

def add_checked(self, value: int) -> None:
...

def update(self, *all_values: Iterable[int]) -> None:
...

def discard(self, value: int) -> None:
...

def remove(self, value: int) -> None:
...

def __ior__(self, other: AbstractBitMap64) -> Self:
...

def __iand__(self, other: AbstractBitMap64) -> Self:
...

def __ixor__(self, other: AbstractBitMap64) -> Self:
...

def __isub__(self, other: AbstractBitMap64) -> Self:
...

def intersection_update(self, *all_values: Iterable[int]) -> None:
...

def difference_update(self, *others: AbstractBitMap64) -> None:
...

def symmetric_difference_update(self, other: AbstractBitMap64) -> None:
...

def overwrite(self, other: AbstractBitMap64) -> None:
...

def clear(self) -> None:
...

def pop(self) -> int:
...

def flip_inplace(self, start: int, end: int) -> None:
...

def add_range(self, range_start: int, range_end: int) -> None:
...

def remove_range(self, range_start: int, range_end: int) -> None:
...
Loading

0 comments on commit b54769b

Please sign in to comment.