Crate croaring_sys

source ·

Structs

Roaring arrays are array-based key-value pairs having containers as values and 16-bit integer keys. A roaring bitmap might be implemented as such.
(For advanced users.) The roaring_statistics_t can be used to collect detailed statistics about the composition of a roaring bitmap.
What follows is code use to iterate through values in a roaring bitmap
A shared container is a wrapper around a container with reference counting.

Constants

Statics

Functions

a64l
abs
Return true if the two containers have the same content.
Return true if the two arrays have the same content.
Increase capacity to at least min. Whether the existing data needs to be copied over depends on the “preserve” parameter. If preserve is false, then the new content will be uninitialized, otherwise the old content is copied.
Return true if container1 is a subset of container2.
Return true if container1 is a subset of container2.
Return true if container1 is a subset of container2.
Reads the instance from buf, outputs how many bytes were read. This is meant to be byte-by-byte compatible with the Java and Go versions of Roaring. The number of bytes read should be array_container_size_in_bytes(container). You need to provide the (known) cardinality.
Writes the underlying array to buf, outputs how many bytes were written. This is meant to be byte-by-byte compatible with the Java and Go versions of Roaring. The number of bytes written should be array_container_size_in_bytes(container).
atof
atoi
atol
bcmp
Return true if the two containers have the same content.
Create new bitset container which is a union of run container and range [min, max]. Caller is responsible for freeing run container.
Return true if container1 is a subset of container2.
Return true if container1 is a subset of container2.
Return the the number of runs.
Reads the instance from buf, outputs how many bytes were read. This is meant to be byte-by-byte compatible with the Java and Go versions of Roaring. The number of bytes read should be bitset_container_size_in_bytes(container). You need to provide the (known) cardinality.
If the element of given rank is in this container, supposing that the first element has rank start_rank, then the function returns true and sets element accordingly. Otherwise, it returns false and update start_rank.
Writes the underlying array to buf, outputs how many bytes were written. This is meant to be byte-by-byte compatible with the Java and Go versions of Roaring. The number of bytes written should be bitset_container_size_in_bytes(container).
Copies a container, requires a typecode. This allocates new memory, caller is responsible for deallocation. If the container is not shared, then it is physically cloned. Sharable containers are not cloneable.
Check whether a value is in a container, requires a typecode
Recover memory from a container, requires a typecode
print the container (useful for debugging), requires a typecode
print the content of the container as a comma-separated list of 32-bit values starting at base, requires a typecode
Generic difference function (ANDNOT).
A fast SSE-based difference function.
div
ecvt
exit
If needed, increase the capacity of the array so that it can fit k values (at least);
combines union_uint16 and union_vector16 optimally
fcvt
feof
ffs
ffsl
free
gcvt
getc
getw
Good old binary search through rle data
Generic intersection function.
Compute the size of the intersection (generic).
Checking whether the size of the intersection is non-zero.
From Schlegel et al., Fast Sorted-Set Intersection using SIMD Instructions Optimized by D. Lemire on May 3rd 2013
Compute the cardinality of the intersection using SSE4 instructions
Generic intersection function.
Generic intersection function, returns just the cardinality.
l64a
labs
ldiv
putc
puts
putw
Append a new key-value pair
appends from sa to ra, starting with the smallest key that is is strictly greater than before_start
appends from sa to ra, ending with the greatest key that is is less or equal stopping_key
Append a new key-value pair to ra, cloning (in COW sense) a value from sa at index index
Append new key-value pairs to ra, cloning (in COW sense) values from sa at indexes [start_index, end_index)
Move the key-value pairs to ra from sa at indexes [start_index, end_index), old array should not be freed (use ra_clear_without_containers)
Append new key-value pairs to ra, from sa at indexes [start_index, end_index)
Frees the memory used by a roaring array
Frees just the containers
Frees the memory used by a roaring array, but does not free the containers
Copies this roaring array, we assume that dest is not initialized
Create a new roaring array
Retrieves the container at index i, filling in the typecode
Get the index corresponding to a 16-bit key
Retrieves the key at index i
return true if it contains at least one run container.
Initialize with default capacity
Initialize an existing roaring array with the specified capacity (in number of containers)
Add a new key-value pair at index i
Copies this roaring array, we assume that dest is initialized
read a bitmap from a serialized version. This is meant to be compatible with the Java and Go versions. maxbytes indicates how many bytes available from buf. When the function returns true, roaring_array_t is populated with the data and *readbytes indicates how many bytes were read. In all cases, if the function returns true, then maxbytes >= *readbytes.
Quickly checks whether there is a serialized bitmap at the pointer, not exceeding size “maxbytes” in bytes. This function does not allocate memory dynamically.
Size of the header when serializing (meant to be compatible with Java and Go versions)
write a bitmap to a buffer. This is meant to be compatible with the Java and Go versions. Return the size in bytes of the serialized output (which should be ra_portable_size_in_bytes(ra)).
How many bytes are required to serialize this bitmap (meant to be compatible with Java and Go versions)
remove at index i, sliding over all entries after i
remove at index i, sliding over all entries after i. Free removed container.
clears all containers, sets the size at 0 and shrinks the memory usage.
Set the container at the corresponding index using the specified typecode.
Shifts rightmost $count containers to the left (distance < 0) or to the right (distance > 0). Allocates memory if necessary. This function doesn’t free or create new containers. Caller is responsible for that.
rand
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.
Add value x
Add value x Returns true if a new value was added, false if the value was already existing.
Add value n_args from pointer vals, faster than repeatedly calling roaring_bitmap_add
Add all values in range [min, max)
Add all values in range [min, max]
Computes the intersection between two bitmaps and returns new bitmap. The caller is responsible for memory management.
Computes the size of the intersection between two bitmaps.
Inplace version modifies x1, x1 == x2 is allowed
Computes the difference (andnot) between two bitmaps and returns new bitmap. The caller is responsible for memory management.
Computes the size of the difference (andnot) between two bitmaps.
Inplace version of roaring_bitmap_andnot, modifies x1. x1 != x2.
Empties the bitmap
Check if value x is present
Check whether a range of values from range_start (included) to range_end (excluded) is present
Copies a bitmap. This does memory allocation. The caller is responsible for memory management.
Creates a new bitmap (initially empty)
Creates a new bitmap (initially empty) with a provided container-storage capacity (it is a performance hint).
use with roaring_bitmap_serialize see roaring_bitmap_portable_deserialize if you want a format that’s compatible with Java and Go implementations
Return true if the two bitmaps contain the same elements.
compute the negation of the roaring bitmap within a specified interval: [range_start, range_end). The number of negated values is range_end - range_start. Areas outside the range are passed through unchanged.
compute (in place) the negation of the roaring bitmap within a specified interval: [range_start, range_end). The number of negated values is range_end - range_start. Areas outside the range are passed through unchanged.
Frees the memory.
Add all the values between min (included) and max (excluded) that are at a distance k*step from min.
Get the cardinality of the bitmap (number of elements).
Check whether two bitmaps intersect.
Returns true if the bitmap is empty (cardinality is zero).
Return true if all the elements of ra1 are also in ra2 and ra2 is strictly greater than ra1.
Return true if all the elements of ra1 are also in ra2.
Computes the Jaccard index between two bitmaps. (Also known as the Tanimoto distance, or the Jaccard similarity coefficient)
(For expert users who seek high performance.)
(For expert users who seek high performance.) Inplace version of roaring_bitmap_lazy_or, modifies x1 The bitsetconversion conversion is a flag which determines whether container-container operations force a bitset conversion.
Computes the symmetric difference between two bitmaps and returns new bitmap. The caller is responsible for memory management.
(For expert users who seek high performance.) Inplace version of roaring_bitmap_lazy_xor, modifies x1. x1 != x2
roaring_bitmap_smallest returns the greatest value in the set. Returns 0 if the set is empty.
roaring_bitmap_smallest returns the smallest value in the set. Returns UINT32_MAX if the set is empty.
Creates a new bitmap from a list of uint32_t integers
Creates a new bitmap from a pointer of uint32_t integers
Computes the union between two bitmaps and returns new bitmap. The caller is responsible for memory management.
Computes the size of the union between two bitmaps.
Inplace version of roaring_bitmap_or, modifies x1. TDOO: decide whether x1 == x2 ok
Compute the union of ‘number’ bitmaps. See also roaring_bitmap_or_many_heap. Caller is responsible for freeing the result.
Compute the union of ‘number’ bitmaps using a heap. This can sometimes be faster than roaring_bitmap_or_many which uses a naive algorithm. Caller is responsible for freeing the result.
Copies a bitmap from src to dest. It is assumed that the pointer dest is to an already allocated bitmap. The content of the dest bitmap is freed/deleted.
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.
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.
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
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
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
Print the content of the bitmap.
Describe the inner structure of the bitmap.
Returns number of elements in range [range_start, range_end).
Convert the bitmap to an array from “offset” by “limit”. Write the output to “ans”. so, you can get data in paging. caller is responsible to ensure that there is enough memory allocated (e.g., ans = malloc(roaring_bitmap_get_cardinality(limit)
roaring_bitmap_rank returns the number of integers that are smaller or equal to x.
Remove value x
Remove value x Returns true if a new value was removed, false if the value was not existing.
Remove multiple values
Remove all values in range [min, max)
Remove all values in range [min, max]
Remove run-length encoding even when it is more space efficient return whether a change was applied
(For expert users who seek high performance.)
convert array and bitmap containers to run containers when it is more efficient; also convert from run containers when more space efficient. Returns true if the result has at least one run container. Additional savings might be possible by calling shrinkToFit().
If the size of the roaring bitmap is strictly greater than rank, then this function returns true and set element to the element of given rank. Otherwise, it returns false.
write the bitmap to an output pointer, this output buffer should refer to at least roaring_bitmap_size_in_bytes(ra) allocated bytes.
If needed, reallocate memory to shrink the memory usage. Returns the number of bytes saved.
How many bytes are required to serialize this bitmap (NOT compatible with Java and Go versions)
(For advanced users.) Collect statistics about the bitmap, see roaring_types.h for a description of roaring_statistics_t
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)
Computes the symmetric difference (xor) between two bitmaps and returns new bitmap. The caller is responsible for memory management.
Computes the size of the symmetric difference (andnot) between two bitmaps.
Inplace version of roaring_bitmap_xor, modifies x1. x1 != x2.
Compute the xor of ‘number’ bitmaps. Caller is responsible for freeing the result.
Creates a copy of an iterator. Caller must free it.
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.
Free memory following roaring_create_iterator
Initialize an iterator object that can be used to iterate through the values. 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.
Iterate over the bitmap elements. The function iterator is called once for all the values with ptr (can be NULL) as the second parameter of each call.
Move the iterator to the first value >= val. If there is a such a value, then it->has_value is true. The new value is in it->current_value. For convenience, returns it->has_value.
Return true if the two containers have the same content.
Return true if the two containers have the same content.
Return true if the two containers have the same content.
increase capacity to at least min. Whether the existing data needs to be copied over depends on copy. If “copy” is false, then the new content will be uninitialized, otherwise a copy is made.
Return true if container1 is a subset of container2.
Return true if container1 is a subset of container2.
Return true if container1 is a subset of container2.
Reads the instance from buf, outputs how many bytes were read. This is meant to be byte-by-byte compatible with the Java and Go versions of Roaring. The number of bytes read should be bitset_container_size_in_bytes(container). The cardinality parameter is provided for consistency with other containers, but it might be effectively ignored..
If the element of given rank is in this container, supposing that the first element has rank start_rank, then the function returns true and sets element accordingly. Otherwise, it returns false and update start_rank.
Used in a start-finish scan that appends segments, for XOR and NOT
Writes the underlying array to buf, outputs how many bytes were written. This is meant to be byte-by-byte compatible with the Java and Go versions of Roaring. The number of bytes written should be run_container_size_in_bytes(container).
Generic union function.
Generic union function.
Generic union function, returns just the cardinality.
A fast SSE-based union function.
Generic XOR function.
A fast SSE-based XOR function.

Type Definitions

During lazy computations, we can transform array containers into bitset containers as long as we can expect them to have ARRAY_LAZY_LOWERBOUND values.
Roaring arrays are array-based key-value pairs having containers as values and 16-bit integer keys. A roaring bitmap might be implemented as such.
(For advanced users.) The roaring_statistics_t can be used to collect detailed statistics about the composition of a roaring bitmap.
What follows is code use to iterate through values in a roaring bitmap

Unions