roaring.c

Members

Functions

roaring_advance_uint32_iterator
bool roaring_advance_uint32_iterator(roaring_uint32_iterator_t* it)

Advance the iterator. If there is a new value, then it->has_value is true. The new value is in it->current_value. Values are traversed in increasing orders. For convenience, returns it->has_value.

roaring_bitmap_add_many
void roaring_bitmap_add_many(roaring_bitmap_t* r, size_t n_args, const uint32_t* vals)

Add value n_args from pointer vals, faster than repeatedly calling roaring_bitmap_add

roaring_bitmap_and
roaring_bitmap_t* roaring_bitmap_and(const roaring_bitmap_t* x1, const roaring_bitmap_t* x2)

Computes the intersection between two bitmaps and returns new bitmap. The caller is responsible for memory management.

roaring_bitmap_deserialize
roaring_bitmap_t* roaring_bitmap_deserialize(const void* buf)

use with roaring_bitmap_serialize see roaring_bitmap_portable_deserialize if you want a format that's compatible with Java and Go implementations

roaring_bitmap_equals
bool roaring_bitmap_equals(const roaring_bitmap_t* ra1, const roaring_bitmap_t* ra2)

Return true if the two bitmaps contain the same elements.

roaring_bitmap_is_subset
bool roaring_bitmap_is_subset(const roaring_bitmap_t* ra1, const roaring_bitmap_t* ra2)

Return true if all the elements of ra1 are also in ra2.

roaring_bitmap_or
roaring_bitmap_t* roaring_bitmap_or(const roaring_bitmap_t* x1, const roaring_bitmap_t* x2)

Computes the union between two bitmaps and returns new bitmap. The caller is responsible for memory management.

roaring_bitmap_portable_deserialize
roaring_bitmap_t* roaring_bitmap_portable_deserialize(const char* buf)

read a bitmap from a serialized version. This is meant to be compatible with the Java and Go versions. See format specification at https://github.com/RoaringBitmap/RoaringFormatSpec

In case of failure, a null pointer is returned. This function is unsafe in the sense that if there is no valid serialized bitmap at the pointer, then many bytes could be read, possibly causing a buffer overflow. For a safer approach, call roaring_bitmap_portable_deserialize_safe.

roaring_bitmap_portable_deserialize_safe
roaring_bitmap_t* roaring_bitmap_portable_deserialize_safe(const char* buf, size_t maxbytes)

read a bitmap from a serialized version in a safe manner (reading up to maxbytes). This is meant to be compatible with the Java and Go versions. See format specification at https://github.com/RoaringBitmap/RoaringFormatSpec

In case of failure, a null pointer is returned.

roaring_bitmap_portable_deserialize_size
size_t roaring_bitmap_portable_deserialize_size(const char* buf, size_t maxbytes)

Check how many bytes would be read (up to maxbytes) at this pointer if there is a bitmap, returns zero if there is no valid bitmap. This is meant to be compatible with the Java and Go versions. See format specification at https://github.com/RoaringBitmap/RoaringFormatSpec

roaring_bitmap_portable_serialize
size_t roaring_bitmap_portable_serialize(const roaring_bitmap_t* ra, char* buf)

write a bitmap to a char buffer. The output buffer should refer to at least roaring_bitmap_portable_size_in_bytes(ra) bytes of allocated memory. This is meant to be compatible with the Java and Go versions. Returns how many bytes were written which should be roaring_bitmap_portable_size_in_bytes(ra). See format specification at https://github.com/RoaringBitmap/RoaringFormatSpec

roaring_bitmap_portable_size_in_bytes
size_t roaring_bitmap_portable_size_in_bytes(const roaring_bitmap_t* ra)

How many bytes are required to serialize this bitmap (meant to be compatible with Java and Go versions). See format specification at https://github.com/RoaringBitmap/RoaringFormatSpec

roaring_bitmap_rank
uint64_t roaring_bitmap_rank(const roaring_bitmap_t* bm, uint32_t x)

roaring_bitmap_rank returns the number of integers that are smaller or equal to x.

roaring_bitmap_serialize
size_t roaring_bitmap_serialize(const roaring_bitmap_t* ra, char* buf)

write the bitmap to an output pointer, this output buffer should refer to at least roaring_bitmap_size_in_bytes(ra) allocated bytes. * see roaring_bitmap_portable_serialize if you want a format that's compatible with Java and Go implementations * this format has the benefit of being sometimes more space efficient than roaring_bitmap_portable_serialize e.g., when the data is sparse. * Returns how many bytes were written which should be roaring_bitmap_size_in_bytes(ra).

roaring_bitmap_size_in_bytes
size_t roaring_bitmap_size_in_bytes(const roaring_bitmap_t* ra)

How many bytes are required to serialize this bitmap (NOT compatible with Java and Go versions)

roaring_bitmap_to_uint32_array
void roaring_bitmap_to_uint32_array(const roaring_bitmap_t* ra, uint32_t* ans)

Convert the bitmap to an array. Write the output to "ans", caller is responsible to ensure that there is enough memory allocated (e.g., ans = malloc(roaring_bitmap_get_cardinality(mybitmap) * sizeof(uint32_t)) )

roaring_bitmap_xor
roaring_bitmap_t* roaring_bitmap_xor(const roaring_bitmap_t* x1, const roaring_bitmap_t* x2)

Computes the symmetric difference (xor) between two bitmaps and returns new bitmap. The caller is responsible for memory management.

roaring_create_iterator
roaring_uint32_iterator_t* roaring_create_iterator(const roaring_bitmap_t* ra)

Create an iterator object that can be used to iterate through the values. Caller is responsible for calling roaring_free_iterator. The iterator is initialized. If there is a value, then it->has_value is true. The first value is in it->current_value. The iterator traverses the values in increasing order. * This function calls roaring_init_iterator.

roaring_free_uint32_iterator
void roaring_free_uint32_iterator(roaring_uint32_iterator_t* it)

Free memory following roaring_create_iterator

Meta