diff options
author | Luca <deri@ntop.org> | 2023-08-23 11:03:59 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2023-08-23 11:03:59 +0200 |
commit | 95fcd08687cc267f750e4cf0399386ec03ab5654 (patch) | |
tree | 0c2859b2c1e0d7fbf3bc58b0e55c2d480f804c0b | |
parent | 9933b5910d4ffa1024478c28bd4b5952eaf9637d (diff) |
Added ndpi_bitmap_is_empty() and ndpi_bitmap_optimize() API calls
-rw-r--r-- | src/include/ndpi_api.h | 4 | ||||
-rw-r--r-- | src/lib/ndpi_bitmap.c | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 4454b6ad0..e83dd1da3 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -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); @@ -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); diff --git a/src/lib/ndpi_bitmap.c b/src/lib/ndpi_bitmap.c index 09c351d82..ce8f3cb0e 100644 --- a/src/lib/ndpi_bitmap.c +++ b/src/lib/ndpi_bitmap.c @@ -134,6 +134,12 @@ 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)); } @@ -141,7 +147,13 @@ ndpi_bitmap_iterator* ndpi_bitmap_iterator_alloc(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)); } /* ******************************************* */ |