12 #include <roaring/roaring_types.h>
15 #include <roaring/bitset/bitset.h>
16 #include <roaring/memory.h>
17 #include <roaring/portability.h>
18 #include <roaring/roaring_version.h>
123 #define roaring_bitmap_from(...) \
125 const uint32_t roaring_bitmap_from_array[] = {0, __VA_ARGS__}; \
126 return roaring_bitmap_of_ptr((sizeof(roaring_bitmap_from_array) / \
127 sizeof(roaring_bitmap_from_array[0])) - \
129 &roaring_bitmap_from_array[1]); \
144 #define roaring_bitmap_from(...) \
145 roaring_bitmap_of_ptr( \
146 (sizeof((const uint32_t[]){0, __VA_ARGS__}) / sizeof(uint32_t)) - 1, \
147 &((const uint32_t[]){0, __VA_ARGS__})[1])
366 const uint32_t *vals);
390 if (max <= min || min > (uint64_t)UINT32_MAX + 1) {
412 if (max <= min || min > (uint64_t)UINT32_MAX + 1) {
422 const uint32_t *vals);
440 uint64_t range_start, uint64_t range_end);
447 uint32_t range_start,
478 uint64_t range_start,
485 uint32_t range_start,
537 size_t limit, uint32_t *ans);
801 uint64_t high_bits,
void *ptr);
839 const bool bitsetconversion);
851 const bool bitsetconversion);
889 uint64_t range_start, uint64_t range_end);
897 uint32_t range_start,
915 uint32_t range_start,
949 const uint32_t *end, uint64_t *ans);
977 roaring_statistics_t *stat);
994 const char **reason);
1115 CROARING_DEPRECATED
static inline bool
1157 uint32_t *buf, uint32_t count);
1185 #if !defined(ROARING_API_NOT_IN_GLOBAL_NAMESPACE)
1186 using namespace ::roaring::api;
roaring_bitmap_t * roaring_bitmap_and(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
bool roaring_bitmap_select(const roaring_bitmap_t *r, uint32_t rank, uint32_t *element)
roaring_bitmap_t * roaring_bitmap_portable_deserialize_safe(const char *buf, size_t maxbytes)
bool roaring_bitmap_add_checked(roaring_bitmap_t *r, uint32_t x)
void roaring_bitmap_andnot_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
roaring_bitmap_t * roaring_bitmap_flip(const roaring_bitmap_t *r1, uint64_t range_start, uint64_t range_end)
void roaring_bitmap_add_range_closed(roaring_bitmap_t *r, uint32_t min, uint32_t max)
size_t roaring_bitmap_portable_deserialize_size(const char *buf, size_t maxbytes)
bool roaring_bitmap_contains_bulk(const roaring_bitmap_t *r, roaring_bulk_context_t *context, uint32_t val)
size_t roaring_bitmap_portable_serialize(const roaring_bitmap_t *r, char *buf)
bool roaring_bitmap_equals(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_bitmap_flip_inplace(roaring_bitmap_t *r1, uint64_t range_start, uint64_t range_end)
size_t roaring_bitmap_shrink_to_fit(roaring_bitmap_t *r)
void roaring_iterator_init_last(const roaring_bitmap_t *r, roaring_uint32_iterator_t *newit)
void roaring_bitmap_remove_many(roaring_bitmap_t *r, size_t n_args, const uint32_t *vals)
roaring_bitmap_t * roaring_bitmap_create_with_capacity(uint32_t cap)
roaring_bitmap_t * roaring_bitmap_or_many(size_t number, const roaring_bitmap_t **rs)
void roaring_bitmap_clear(roaring_bitmap_t *r)
bool roaring_bitmap_intersect(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
bool roaring_iterate64(const roaring_bitmap_t *r, roaring_iterator64 iterator, uint64_t high_bits, void *ptr)
void roaring_bitmap_printf_describe(const roaring_bitmap_t *r)
bool roaring_bitmap_internal_validate(const roaring_bitmap_t *r, const char **reason)
static CROARING_DEPRECATED void roaring_init_iterator(const roaring_bitmap_t *r, roaring_uint32_iterator_t *newit)
bool roaring_bitmap_run_optimize(roaring_bitmap_t *r)
void roaring_bitmap_and_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
uint64_t roaring_bitmap_or_cardinality(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
static CROARING_DEPRECATED void roaring_init_iterator_last(const roaring_bitmap_t *r, roaring_uint32_iterator_t *newit)
roaring_bitmap_t * roaring_bitmap_lazy_xor(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_iterator_init(const roaring_bitmap_t *r, roaring_uint32_iterator_t *newit)
size_t roaring_bitmap_frozen_size_in_bytes(const roaring_bitmap_t *r)
roaring_bitmap_t * roaring_bitmap_create(void)
uint64_t roaring_bitmap_range_cardinality(const roaring_bitmap_t *r, uint64_t range_start, uint64_t range_end)
bool roaring_bitmap_range_uint32_array(const roaring_bitmap_t *r, size_t offset, size_t limit, uint32_t *ans)
bool roaring_bitmap_get_copy_on_write(const roaring_bitmap_t *r)
void roaring_bitmap_to_uint32_array(const roaring_bitmap_t *r, uint32_t *ans)
bool roaring_bitmap_overwrite(roaring_bitmap_t *dest, const roaring_bitmap_t *src)
void roaring_bitmap_xor_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
bool roaring_uint32_iterator_move_equalorlarger(roaring_uint32_iterator_t *it, uint32_t val)
roaring_bitmap_t * roaring_bitmap_or(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
double roaring_bitmap_jaccard_index(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
static CROARING_DEPRECATED roaring_uint32_iterator_t * roaring_create_iterator(const roaring_bitmap_t *r)
size_t roaring_bitmap_size_in_bytes(const roaring_bitmap_t *r)
bool roaring_uint32_iterator_previous(roaring_uint32_iterator_t *it)
roaring_uint32_iterator_t * roaring_iterator_create(const roaring_bitmap_t *r)
bool roaring_bitmap_remove_run_compression(roaring_bitmap_t *r)
bool roaring_iterate(const roaring_bitmap_t *r, roaring_iterator iterator, void *ptr)
void roaring_bitmap_init_cleared(roaring_bitmap_t *r)
void roaring_bitmap_add_bulk(roaring_bitmap_t *r, roaring_bulk_context_t *context, uint32_t val)
void roaring_bitmap_frozen_serialize(const roaring_bitmap_t *r, char *buf)
void roaring_bitmap_remove_range(roaring_bitmap_t *r, uint64_t min, uint64_t max)
roaring_bitmap_t * roaring_bitmap_xor_many(size_t number, const roaring_bitmap_t **rs)
void roaring_bitmap_lazy_xor_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_bitmap_add_many(roaring_bitmap_t *r, size_t n_args, const uint32_t *vals)
bool roaring_bitmap_contains_range(const roaring_bitmap_t *r, uint64_t range_start, uint64_t range_end)
void roaring_bitmap_lazy_or_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2, const bool bitsetconversion)
roaring_bitmap_t * roaring_bitmap_deserialize(const void *buf)
bool roaring_bitmap_is_empty(const roaring_bitmap_t *r)
static CROARING_DEPRECATED bool roaring_previous_uint32_iterator(roaring_uint32_iterator_t *it)
roaring_bitmap_t * roaring_bitmap_portable_deserialize_frozen(const char *buf)
void roaring_bitmap_free(const roaring_bitmap_t *r)
void roaring_bitmap_statistics(const roaring_bitmap_t *r, roaring_statistics_t *stat)
bool roaring_bitmap_contains(const roaring_bitmap_t *r, uint32_t val)
void roaring_bitmap_remove(roaring_bitmap_t *r, uint32_t x)
roaring_bitmap_t * roaring_bitmap_of_ptr(size_t n_args, const uint32_t *vals)
roaring_bitmap_t * roaring_bitmap_flip_closed(const roaring_bitmap_t *x1, uint32_t range_start, uint32_t range_end)
void roaring_bitmap_set_copy_on_write(roaring_bitmap_t *r, bool cow)
CROARING_DEPRECATED roaring_bitmap_t * roaring_bitmap_of(size_t n,...)
void roaring_bitmap_remove_range_closed(roaring_bitmap_t *r, uint32_t min, uint32_t max)
roaring_bitmap_t * roaring_bitmap_copy(const roaring_bitmap_t *r)
const roaring_bitmap_t * roaring_bitmap_frozen_view(const char *buf, size_t length)
bool roaring_bitmap_is_strict_subset(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
roaring_bitmap_t * roaring_bitmap_add_offset(const roaring_bitmap_t *bm, int64_t offset)
roaring_bitmap_t * roaring_bitmap_portable_deserialize(const char *buf)
struct roaring_bitmap_s roaring_bitmap_t
uint64_t roaring_bitmap_xor_cardinality(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
bool roaring_bitmap_to_bitset(const roaring_bitmap_t *r, bitset_t *bitset)
uint64_t roaring_bitmap_andnot_cardinality(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
bool roaring_bitmap_intersect_with_range(const roaring_bitmap_t *bm, uint64_t x, uint64_t y)
roaring_bitmap_t * roaring_bitmap_lazy_or(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2, const bool bitsetconversion)
size_t roaring_bitmap_portable_size_in_bytes(const roaring_bitmap_t *r)
bool roaring_bitmap_is_subset(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
static CROARING_DEPRECATED uint32_t roaring_read_uint32_iterator(roaring_uint32_iterator_t *it, uint32_t *buf, uint32_t count)
void roaring_bitmap_rank_many(const roaring_bitmap_t *r, const uint32_t *begin, const uint32_t *end, uint64_t *ans)
roaring_bitmap_t * roaring_bitmap_xor(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
void roaring_bitmap_or_inplace(roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
uint32_t roaring_uint32_iterator_read(roaring_uint32_iterator_t *it, uint32_t *buf, uint32_t count)
uint64_t roaring_bitmap_rank(const roaring_bitmap_t *r, uint32_t x)
void roaring_uint32_iterator_free(roaring_uint32_iterator_t *it)
static CROARING_DEPRECATED bool roaring_move_uint32_iterator_equalorlarger(roaring_uint32_iterator_t *it, uint32_t val)
uint32_t roaring_bitmap_maximum(const roaring_bitmap_t *r)
roaring_bitmap_t * roaring_bitmap_or_many_heap(uint32_t number, const roaring_bitmap_t **rs)
bool roaring_bitmap_init_with_capacity(roaring_bitmap_t *r, uint32_t cap)
void roaring_bitmap_add_range(roaring_bitmap_t *r, uint64_t min, uint64_t max)
static CROARING_DEPRECATED roaring_uint32_iterator_t * roaring_copy_uint32_iterator(const roaring_uint32_iterator_t *it)
void roaring_bitmap_flip_inplace_closed(roaring_bitmap_t *r1, uint32_t range_start, uint32_t range_end)
int64_t roaring_bitmap_get_index(const roaring_bitmap_t *r, uint32_t x)
uint64_t roaring_bitmap_get_cardinality(const roaring_bitmap_t *r)
uint64_t roaring_bitmap_range_cardinality_closed(const roaring_bitmap_t *r, uint32_t range_start, uint32_t range_end)
size_t roaring_bitmap_serialize(const roaring_bitmap_t *r, char *buf)
uint64_t roaring_bitmap_and_cardinality(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
roaring_bitmap_t * roaring_bitmap_andnot(const roaring_bitmap_t *r1, const roaring_bitmap_t *r2)
roaring_uint32_iterator_t * roaring_uint32_iterator_copy(const roaring_uint32_iterator_t *it)
struct roaring_bulk_context_s roaring_bulk_context_t
struct roaring_uint32_iterator_s roaring_uint32_iterator_t
bool roaring_bitmap_contains_range_closed(const roaring_bitmap_t *r, uint32_t range_start, uint32_t range_end)
bool roaring_bitmap_remove_checked(roaring_bitmap_t *r, uint32_t x)
static CROARING_DEPRECATED bool roaring_advance_uint32_iterator(roaring_uint32_iterator_t *it)
roaring_bitmap_t * roaring_bitmap_deserialize_safe(const void *buf, size_t maxbytes)
void roaring_bitmap_repair_after_lazy(roaring_bitmap_t *r1)
void roaring_bitmap_printf(const roaring_bitmap_t *r)
bool roaring_uint32_iterator_advance(roaring_uint32_iterator_t *it)
static CROARING_DEPRECATED void roaring_free_uint32_iterator(roaring_uint32_iterator_t *it)
uint32_t roaring_bitmap_minimum(const roaring_bitmap_t *r)
void roaring_bitmap_add(roaring_bitmap_t *r, uint32_t x)
roaring_bitmap_t * roaring_bitmap_from_range(uint64_t min, uint64_t max, uint32_t step)
roaring_array_t high_low_container
ROARING_CONTAINER_T * container
const roaring_bitmap_t * parent
const ROARING_CONTAINER_T * container
roaring_container_iterator_t container_it