Skip to content

Commit

Permalink
Add roaring64_bitmap_clear function
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann committed May 23, 2024
1 parent 6f50ee0 commit d51db22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/roaring/roaring64.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ void roaring64_bitmap_remove_range(roaring64_bitmap_t *r, uint64_t min,
void roaring64_bitmap_remove_range_closed(roaring64_bitmap_t *r, uint64_t min,
uint64_t max);

/**
* Empties the bitmap.
*/
void roaring64_bitmap_clear(roaring64_bitmap_t *r);

/**
* Returns true if the provided value is present.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/roaring64.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,10 @@ void roaring64_bitmap_remove_range_closed(roaring64_bitmap_t *r, uint64_t min,
remove_range_closed_at(art, max_high48, 0, max_low16);
}

void roaring64_bitmap_clear(roaring64_bitmap_t *r) {
roaring64_bitmap_remove_range_closed(r, 0, UINT64_MAX);
}

uint64_t roaring64_bitmap_get_cardinality(const roaring64_bitmap_t *r) {
art_iterator_t it = art_init_iterator(&r->art, /*first=*/true);
uint64_t cardinality = 0;
Expand Down

0 comments on commit d51db22

Please sign in to comment.