Skip to content

Commit

Permalink
Added ndpi_bitmap_is_empty() and ndpi_bitmap_optimize() API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Aug 23, 2023
1 parent 9933b59 commit 95fcd08
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/include/ndpi_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,7 @@ extern "C" {
void ndpi_bitmap_free(ndpi_bitmap* b);
ndpi_bitmap* ndpi_bitmap_copy(ndpi_bitmap* b);
u_int64_t ndpi_bitmap_cardinality(ndpi_bitmap* b);
bool ndpi_bitmap_is_empty(ndpi_bitmap* b);
void ndpi_bitmap_set(ndpi_bitmap* b, u_int32_t value);
void ndpi_bitmap_unset(ndpi_bitmap* b, u_int32_t value);
bool ndpi_bitmap_isset(ndpi_bitmap* b, u_int32_t value);
Expand All @@ -1986,7 +1987,8 @@ extern "C" {
void ndpi_bitmap_andnot(ndpi_bitmap* a, ndpi_bitmap* b_and);
void ndpi_bitmap_or(ndpi_bitmap* a, ndpi_bitmap* b_or);
void ndpi_bitmap_xor(ndpi_bitmap* a, ndpi_bitmap* b_xor);

void ndpi_bitmap_optimize(ndpi_bitmap* a);

ndpi_bitmap_iterator* ndpi_bitmap_iterator_alloc(ndpi_bitmap* b);
void ndpi_bitmap_iterator_free(ndpi_bitmap* b);
bool ndpi_bitmap_iterator_next(ndpi_bitmap_iterator* i, u_int32_t *value);
Expand Down
14 changes: 13 additions & 1 deletion src/lib/ndpi_bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,26 @@ void ndpi_bitmap_xor(ndpi_bitmap* a, ndpi_bitmap* b_xor) {

/* ******************************************* */

void ndpi_bitmap_optimize(ndpi_bitmap* a) {
roaring_bitmap_run_optimize(a);
}

/* ******************************************* */

ndpi_bitmap_iterator* ndpi_bitmap_iterator_alloc(ndpi_bitmap* b) {
return(roaring_create_iterator((ndpi_bitmap*)b));
}

/* ******************************************* */

void ndpi_bitmap_iterator_free(ndpi_bitmap* b) {
return(roaring_free_uint32_iterator((ndpi_bitmap*)b));
roaring_free_uint32_iterator((ndpi_bitmap*)b);
}

/* ******************************************* */

bool ndpi_bitmap_is_empty(ndpi_bitmap* b) {
return(roaring_bitmap_is_empty((ndpi_bitmap*)b));
}

/* ******************************************* */
Expand Down

0 comments on commit 95fcd08

Please sign in to comment.