croaring_sys/CRoaring/
bindgen_bundled_version.rs

1/* automatically generated by rust-bindgen 0.72.1 */
2
3pub const ROARING_VERSION: &[u8; 6] = b"4.5.1\0";
4pub const ROARING_VERSION_MAJOR: _bindgen_ty_1 = 4;
5pub const ROARING_VERSION_MINOR: _bindgen_ty_1 = 5;
6pub const ROARING_VERSION_REVISION: _bindgen_ty_1 = 1;
7pub type _bindgen_ty_1 = ::core::ffi::c_uint;
8extern "C" {
9    #[doc = " result might be undefined when input_num is zero"]
10    pub fn roaring_trailing_zeroes(input_num: ::core::ffi::c_ulonglong) -> ::core::ffi::c_int;
11}
12extern "C" {
13    #[doc = " result might be undefined when input_num is zero"]
14    pub fn roaring_leading_zeroes(input_num: ::core::ffi::c_ulonglong) -> ::core::ffi::c_int;
15}
16#[doc = " Roaring arrays are array-based key-value pairs having containers as values\n and 16-bit integer keys. A roaring bitmap  might be implemented as such."]
17#[repr(C)]
18#[derive(Debug, Copy, Clone)]
19pub struct roaring_array_s {
20    pub size: i32,
21    pub allocation_size: i32,
22    pub containers: *mut *mut ::core::ffi::c_void,
23    pub keys: *mut u16,
24    pub typecodes: *mut u8,
25    pub flags: u8,
26}
27#[doc = " Roaring arrays are array-based key-value pairs having containers as values\n and 16-bit integer keys. A roaring bitmap  might be implemented as such."]
28pub type roaring_array_t = roaring_array_s;
29pub type roaring_iterator = ::core::option::Option<
30    unsafe extern "C" fn(value: u32, param: *mut ::core::ffi::c_void) -> bool,
31>;
32pub type roaring_iterator64 = ::core::option::Option<
33    unsafe extern "C" fn(value: u64, param: *mut ::core::ffi::c_void) -> bool,
34>;
35#[doc = "  (For advanced users.)\n The roaring_statistics_t can be used to collect detailed statistics about\n the composition of a roaring bitmap."]
36#[repr(C)]
37#[derive(Debug, Copy, Clone)]
38pub struct roaring_statistics_s {
39    pub n_containers: u32,
40    pub n_array_containers: u32,
41    pub n_run_containers: u32,
42    pub n_bitset_containers: u32,
43    pub n_values_array_containers: u32,
44    pub n_values_run_containers: u32,
45    pub n_values_bitset_containers: u32,
46    pub n_bytes_array_containers: u32,
47    pub n_bytes_run_containers: u32,
48    pub n_bytes_bitset_containers: u32,
49    pub max_value: u32,
50    pub min_value: u32,
51    pub sum_value: u64,
52    pub cardinality: u64,
53}
54#[doc = "  (For advanced users.)\n The roaring_statistics_t can be used to collect detailed statistics about\n the composition of a roaring bitmap."]
55pub type roaring_statistics_t = roaring_statistics_s;
56#[doc = "  (For advanced users.)\n The roaring64_statistics_t can be used to collect detailed statistics about\n the composition of a roaring64 bitmap."]
57#[repr(C)]
58#[derive(Debug, Copy, Clone)]
59pub struct roaring64_statistics_s {
60    pub n_containers: u64,
61    pub n_array_containers: u64,
62    pub n_run_containers: u64,
63    pub n_bitset_containers: u64,
64    pub n_values_array_containers: u64,
65    pub n_values_run_containers: u64,
66    pub n_values_bitset_containers: u64,
67    pub n_bytes_array_containers: u64,
68    pub n_bytes_run_containers: u64,
69    pub n_bytes_bitset_containers: u64,
70    pub max_value: u64,
71    pub min_value: u64,
72    pub cardinality: u64,
73}
74#[doc = "  (For advanced users.)\n The roaring64_statistics_t can be used to collect detailed statistics about\n the composition of a roaring64 bitmap."]
75pub type roaring64_statistics_t = roaring64_statistics_s;
76#[doc = " Roaring-internal type used to iterate within a roaring container."]
77#[repr(C)]
78#[derive(Debug, Copy, Clone)]
79pub struct roaring_container_iterator_s {
80    pub index: i32,
81}
82#[doc = " Roaring-internal type used to iterate within a roaring container."]
83pub type roaring_container_iterator_t = roaring_container_iterator_s;
84#[repr(C)]
85#[derive(Debug, Copy, Clone)]
86pub struct bitset_s {
87    pub array: *mut u64,
88    pub arraysize: usize,
89    pub capacity: usize,
90}
91pub type bitset_t = bitset_s;
92extern "C" {
93    pub fn bitset_create() -> *mut bitset_t;
94}
95extern "C" {
96    pub fn bitset_create_with_capacity(size: usize) -> *mut bitset_t;
97}
98extern "C" {
99    pub fn bitset_free(bitset: *mut bitset_t);
100}
101extern "C" {
102    pub fn bitset_clear(bitset: *mut bitset_t);
103}
104extern "C" {
105    pub fn bitset_fill(bitset: *mut bitset_t);
106}
107extern "C" {
108    pub fn bitset_copy(bitset: *const bitset_t) -> *mut bitset_t;
109}
110extern "C" {
111    pub fn bitset_resize(bitset: *mut bitset_t, newarraysize: usize, padwithzeroes: bool) -> bool;
112}
113extern "C" {
114    pub fn bitset_size_in_bytes(bitset: *const bitset_t) -> usize;
115}
116extern "C" {
117    pub fn bitset_size_in_bits(bitset: *const bitset_t) -> usize;
118}
119extern "C" {
120    pub fn bitset_size_in_words(bitset: *const bitset_t) -> usize;
121}
122extern "C" {
123    pub fn bitset_grow(bitset: *mut bitset_t, newarraysize: usize) -> bool;
124}
125extern "C" {
126    pub fn bitset_trim(bitset: *mut bitset_t) -> bool;
127}
128extern "C" {
129    pub fn bitset_shift_left(bitset: *mut bitset_t, s: usize);
130}
131extern "C" {
132    pub fn bitset_shift_right(bitset: *mut bitset_t, s: usize);
133}
134extern "C" {
135    pub fn bitset_set(bitset: *mut bitset_t, i: usize);
136}
137extern "C" {
138    pub fn bitset_set_to_value(bitset: *mut bitset_t, i: usize, flag: bool);
139}
140extern "C" {
141    pub fn bitset_get(bitset: *const bitset_t, i: usize) -> bool;
142}
143extern "C" {
144    pub fn bitset_count(bitset: *const bitset_t) -> usize;
145}
146extern "C" {
147    pub fn bitset_empty(bitset: *const bitset_t) -> bool;
148}
149extern "C" {
150    pub fn bitset_minimum(bitset: *const bitset_t) -> usize;
151}
152extern "C" {
153    pub fn bitset_maximum(bitset: *const bitset_t) -> usize;
154}
155extern "C" {
156    pub fn bitset_inplace_union(b1: *mut bitset_t, b2: *const bitset_t) -> bool;
157}
158extern "C" {
159    pub fn bitset_union_count(b1: *const bitset_t, b2: *const bitset_t) -> usize;
160}
161extern "C" {
162    pub fn bitset_inplace_intersection(b1: *mut bitset_t, b2: *const bitset_t);
163}
164extern "C" {
165    pub fn bitset_intersection_count(b1: *const bitset_t, b2: *const bitset_t) -> usize;
166}
167extern "C" {
168    pub fn bitsets_disjoint(b1: *const bitset_t, b2: *const bitset_t) -> bool;
169}
170extern "C" {
171    pub fn bitsets_intersect(b1: *const bitset_t, b2: *const bitset_t) -> bool;
172}
173extern "C" {
174    pub fn bitset_contains_all(b1: *const bitset_t, b2: *const bitset_t) -> bool;
175}
176extern "C" {
177    pub fn bitset_inplace_difference(b1: *mut bitset_t, b2: *const bitset_t);
178}
179extern "C" {
180    pub fn bitset_difference_count(b1: *const bitset_t, b2: *const bitset_t) -> usize;
181}
182extern "C" {
183    pub fn bitset_inplace_symmetric_difference(b1: *mut bitset_t, b2: *const bitset_t) -> bool;
184}
185extern "C" {
186    pub fn bitset_symmetric_difference_count(b1: *const bitset_t, b2: *const bitset_t) -> usize;
187}
188extern "C" {
189    pub fn bitset_next_set_bit(bitset: *const bitset_t, i: *mut usize) -> bool;
190}
191extern "C" {
192    pub fn bitset_next_set_bits(
193        bitset: *const bitset_t,
194        buffer: *mut usize,
195        capacity: usize,
196        startfrom: *mut usize,
197    ) -> usize;
198}
199pub type bitset_iterator = ::core::option::Option<
200    unsafe extern "C" fn(value: usize, param: *mut ::core::ffi::c_void) -> bool,
201>;
202extern "C" {
203    pub fn bitset_for_each(
204        b: *const bitset_t,
205        iterator: bitset_iterator,
206        ptr: *mut ::core::ffi::c_void,
207    ) -> bool;
208}
209extern "C" {
210    pub fn bitset_print(b: *const bitset_t);
211}
212pub type container_t = ::core::ffi::c_void;
213extern "C" {
214    pub fn bitset_extract_setbits_avx2(
215        words: *const u64,
216        length: usize,
217        out: *mut u32,
218        outcapacity: usize,
219        base: u32,
220    ) -> usize;
221}
222extern "C" {
223    pub fn bitset_extract_setbits_avx512(
224        words: *const u64,
225        length: usize,
226        out: *mut u32,
227        outcapacity: usize,
228        base: u32,
229    ) -> usize;
230}
231extern "C" {
232    pub fn bitset_extract_setbits(
233        words: *const u64,
234        length: usize,
235        out: *mut u32,
236        base: u32,
237    ) -> usize;
238}
239extern "C" {
240    pub fn bitset_extract_setbits_sse_uint16(
241        words: *const u64,
242        length: usize,
243        out: *mut u16,
244        outcapacity: usize,
245        base: u16,
246    ) -> usize;
247}
248extern "C" {
249    pub fn bitset_extract_setbits_avx512_uint16(
250        words: *const u64,
251        length: usize,
252        out: *mut u16,
253        outcapacity: usize,
254        base: u16,
255    ) -> usize;
256}
257extern "C" {
258    pub fn bitset_extract_setbits_uint16(
259        words: *const u64,
260        length: usize,
261        out: *mut u16,
262        base: u16,
263    ) -> usize;
264}
265extern "C" {
266    pub fn bitset_extract_intersection_setbits_uint16(
267        words1: *const u64,
268        words2: *const u64,
269        length: usize,
270        out: *mut u16,
271        base: u16,
272    ) -> usize;
273}
274extern "C" {
275    pub fn bitset_set_list_withcard(
276        words: *mut u64,
277        card: u64,
278        list: *const u16,
279        length: u64,
280    ) -> u64;
281}
282extern "C" {
283    pub fn bitset_set_list(words: *mut u64, list: *const u16, length: u64);
284}
285extern "C" {
286    pub fn bitset_clear_list(words: *mut u64, card: u64, list: *const u16, length: u64) -> u64;
287}
288extern "C" {
289    pub fn bitset_flip_list_withcard(
290        words: *mut u64,
291        card: u64,
292        list: *const u16,
293        length: u64,
294    ) -> u64;
295}
296extern "C" {
297    pub fn bitset_flip_list(words: *mut u64, list: *const u16, length: u64);
298}
299pub const BITSET_CONTAINER_SIZE_IN_WORDS: _bindgen_ty_4 = 1024;
300pub const BITSET_UNKNOWN_CARDINALITY: _bindgen_ty_4 = -1;
301pub type _bindgen_ty_4 = ::core::ffi::c_int;
302#[repr(C)]
303#[derive(Debug, Copy, Clone)]
304pub struct rle16_s {
305    pub value: u16,
306    pub length: u16,
307}
308pub type rle16_t = rle16_s;
309#[repr(C)]
310#[derive(Debug, Copy, Clone)]
311pub struct roaring_bitmap_s {
312    pub high_low_container: roaring_array_t,
313}
314pub type roaring_bitmap_t = roaring_bitmap_s;
315extern "C" {
316    #[doc = " Dynamically allocates a new bitmap (initially empty).\n Returns NULL if the allocation fails.\n Capacity is a performance hint for how many \"containers\" the data will need.\n Client is responsible for calling `roaring_bitmap_free()`."]
317    pub fn roaring_bitmap_create_with_capacity(cap: u32) -> *mut roaring_bitmap_t;
318}
319extern "C" {
320    #[doc = " Dynamically allocates a new bitmap (initially empty).\n Returns NULL if the allocation fails.\n Client is responsible for calling `roaring_bitmap_free()`."]
321    pub fn roaring_bitmap_create() -> *mut roaring_bitmap_t;
322}
323extern "C" {
324    #[doc = " Initialize a roaring bitmap structure in memory controlled by client.\n Capacity is a performance hint for how many \"containers\" the data will need.\n Can return false if auxiliary allocations fail when capacity greater than 0."]
325    pub fn roaring_bitmap_init_with_capacity(r: *mut roaring_bitmap_t, cap: u32) -> bool;
326}
327extern "C" {
328    #[doc = " Initialize a roaring bitmap structure in memory controlled by client.\n The bitmap will be in a \"clear\" state, with no auxiliary allocations.\n Since this performs no allocations, the function will not fail."]
329    pub fn roaring_bitmap_init_cleared(r: *mut roaring_bitmap_t);
330}
331extern "C" {
332    #[doc = " Add all the values between min (included) and max (excluded) that are at a\n distance k*step from min.\n The returned pointer may be NULL in case of errors."]
333    pub fn roaring_bitmap_from_range(min: u64, max: u64, step: u32) -> *mut roaring_bitmap_t;
334}
335extern "C" {
336    #[doc = " Creates a new bitmap from a pointer of uint32_t integers\n The returned pointer may be NULL in case of errors."]
337    pub fn roaring_bitmap_of_ptr(n_args: usize, vals: *const u32) -> *mut roaring_bitmap_t;
338}
339extern "C" {
340    #[doc = " Check if the bitmap contains any shared containers."]
341    pub fn roaring_contains_shared(r: *const roaring_bitmap_t) -> bool;
342}
343extern "C" {
344    #[doc = " Unshare all shared containers.\n Returns true if any unsharing was performed, false if there were no shared\n containers."]
345    pub fn roaring_unshare_all(r: *mut roaring_bitmap_t) -> bool;
346}
347extern "C" {
348    pub fn roaring_bitmap_get_copy_on_write(r: *const roaring_bitmap_t) -> bool;
349}
350extern "C" {
351    pub fn roaring_bitmap_set_copy_on_write(r: *mut roaring_bitmap_t, cow: bool);
352}
353extern "C" {
354    #[doc = " Return a copy of the bitmap with all values shifted by offset.\n The returned pointer may be NULL in case of errors. The caller is responsible\n for freeing the return bitmap."]
355    pub fn roaring_bitmap_add_offset(
356        bm: *const roaring_bitmap_t,
357        offset: i64,
358    ) -> *mut roaring_bitmap_t;
359}
360extern "C" {
361    #[doc = " Describe the inner structure of the bitmap."]
362    pub fn roaring_bitmap_printf_describe(r: *const roaring_bitmap_t);
363}
364extern "C" {
365    #[doc = " Creates a new bitmap from a list of uint32_t integers\n\n This function is deprecated, use `roaring_bitmap_from` instead, which\n doesn't require the number of elements to be passed in.\n\n @see roaring_bitmap_from"]
366    pub fn roaring_bitmap_of(n: usize, ...) -> *mut roaring_bitmap_t;
367}
368extern "C" {
369    #[doc = " Copies a bitmap (this does memory allocation).\n The caller is responsible for memory management.\n The returned pointer may be NULL in case of errors."]
370    pub fn roaring_bitmap_copy(r: *const roaring_bitmap_t) -> *mut roaring_bitmap_t;
371}
372extern "C" {
373    #[doc = " Copies a bitmap from src to dest. It is assumed that the pointer dest\n is to an already allocated bitmap. The content of the dest bitmap is\n freed/deleted.\n\n It might be preferable and simpler to call roaring_bitmap_copy except\n that roaring_bitmap_overwrite can save on memory allocations.\n\n Returns true if successful, or false if there was an error. On failure,\n the dest bitmap is left in a valid, empty state (even if it was not empty\n before)."]
374    pub fn roaring_bitmap_overwrite(
375        dest: *mut roaring_bitmap_t,
376        src: *const roaring_bitmap_t,
377    ) -> bool;
378}
379extern "C" {
380    #[doc = " Print the content of the bitmap."]
381    pub fn roaring_bitmap_printf(r: *const roaring_bitmap_t);
382}
383extern "C" {
384    #[doc = " Computes the intersection between two bitmaps and returns new bitmap. The\n caller is responsible for memory management.\n\n Performance hint: if you are computing the intersection between several\n bitmaps, two-by-two, it is best to start with the smallest bitmap.\n You may also rely on roaring_bitmap_and_inplace to avoid creating\n many temporary bitmaps.\n The returned pointer may be NULL in case of errors."]
385    pub fn roaring_bitmap_and(
386        r1: *const roaring_bitmap_t,
387        r2: *const roaring_bitmap_t,
388    ) -> *mut roaring_bitmap_t;
389}
390extern "C" {
391    #[doc = " Computes the size of the intersection between two bitmaps."]
392    pub fn roaring_bitmap_and_cardinality(
393        r1: *const roaring_bitmap_t,
394        r2: *const roaring_bitmap_t,
395    ) -> u64;
396}
397extern "C" {
398    #[doc = " Check whether two bitmaps intersect."]
399    pub fn roaring_bitmap_intersect(
400        r1: *const roaring_bitmap_t,
401        r2: *const roaring_bitmap_t,
402    ) -> bool;
403}
404extern "C" {
405    #[doc = " Check whether a bitmap and an open range intersect."]
406    pub fn roaring_bitmap_intersect_with_range(bm: *const roaring_bitmap_t, x: u64, y: u64)
407        -> bool;
408}
409extern "C" {
410    #[doc = " Computes the Jaccard index between two bitmaps. (Also known as the Tanimoto\n distance, or the Jaccard similarity coefficient)\n\n The Jaccard index is undefined if both bitmaps are empty."]
411    pub fn roaring_bitmap_jaccard_index(
412        r1: *const roaring_bitmap_t,
413        r2: *const roaring_bitmap_t,
414    ) -> f64;
415}
416extern "C" {
417    #[doc = " Computes the size of the union between two bitmaps."]
418    pub fn roaring_bitmap_or_cardinality(
419        r1: *const roaring_bitmap_t,
420        r2: *const roaring_bitmap_t,
421    ) -> u64;
422}
423extern "C" {
424    #[doc = " Computes the size of the difference (andnot) between two bitmaps."]
425    pub fn roaring_bitmap_andnot_cardinality(
426        r1: *const roaring_bitmap_t,
427        r2: *const roaring_bitmap_t,
428    ) -> u64;
429}
430extern "C" {
431    #[doc = " Computes the size of the symmetric difference (xor) between two bitmaps."]
432    pub fn roaring_bitmap_xor_cardinality(
433        r1: *const roaring_bitmap_t,
434        r2: *const roaring_bitmap_t,
435    ) -> u64;
436}
437extern "C" {
438    #[doc = " Inplace version of `roaring_bitmap_and()`, modifies r1\n r1 == r2 is allowed.\n\n Performance hint: if you are computing the intersection between several\n bitmaps, two-by-two, it is best to start with the smallest bitmap."]
439    pub fn roaring_bitmap_and_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
440}
441extern "C" {
442    #[doc = " Computes the union between two bitmaps and returns new bitmap. The caller is\n responsible for memory management.\n The returned pointer may be NULL in case of errors."]
443    pub fn roaring_bitmap_or(
444        r1: *const roaring_bitmap_t,
445        r2: *const roaring_bitmap_t,
446    ) -> *mut roaring_bitmap_t;
447}
448extern "C" {
449    #[doc = " Inplace version of `roaring_bitmap_or(), modifies r1.\n TODO: decide whether r1 == r2 ok"]
450    pub fn roaring_bitmap_or_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
451}
452extern "C" {
453    #[doc = " Compute the union of 'number' bitmaps.\n Caller is responsible for freeing the result.\n See also `roaring_bitmap_or_many_heap()`\n The returned pointer may be NULL in case of errors."]
454    pub fn roaring_bitmap_or_many(
455        number: usize,
456        rs: *mut *const roaring_bitmap_t,
457    ) -> *mut roaring_bitmap_t;
458}
459extern "C" {
460    #[doc = " Compute the union of 'number' bitmaps using a heap. This can sometimes be\n faster than `roaring_bitmap_or_many() which uses a naive algorithm.\n Caller is responsible for freeing the result."]
461    pub fn roaring_bitmap_or_many_heap(
462        number: u32,
463        rs: *mut *const roaring_bitmap_t,
464    ) -> *mut roaring_bitmap_t;
465}
466extern "C" {
467    #[doc = " Computes the symmetric difference (xor) between two bitmaps\n and returns new bitmap. The caller is responsible for memory management.\n The returned pointer may be NULL in case of errors."]
468    pub fn roaring_bitmap_xor(
469        r1: *const roaring_bitmap_t,
470        r2: *const roaring_bitmap_t,
471    ) -> *mut roaring_bitmap_t;
472}
473extern "C" {
474    #[doc = " Inplace version of roaring_bitmap_xor, modifies r1, r1 != r2."]
475    pub fn roaring_bitmap_xor_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
476}
477extern "C" {
478    #[doc = " Compute the xor of 'number' bitmaps.\n Caller is responsible for freeing the result.\n The returned pointer may be NULL in case of errors."]
479    pub fn roaring_bitmap_xor_many(
480        number: usize,
481        rs: *mut *const roaring_bitmap_t,
482    ) -> *mut roaring_bitmap_t;
483}
484extern "C" {
485    #[doc = " Computes the difference (andnot) between two bitmaps and returns new bitmap.\n Caller is responsible for freeing the result.\n The returned pointer may be NULL in case of errors."]
486    pub fn roaring_bitmap_andnot(
487        r1: *const roaring_bitmap_t,
488        r2: *const roaring_bitmap_t,
489    ) -> *mut roaring_bitmap_t;
490}
491extern "C" {
492    #[doc = " Inplace version of roaring_bitmap_andnot, modifies r1, r1 != r2."]
493    pub fn roaring_bitmap_andnot_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
494}
495extern "C" {
496    #[doc = " Frees the memory."]
497    pub fn roaring_bitmap_free(r: *const roaring_bitmap_t);
498}
499#[doc = " A bit of context usable with `roaring_bitmap_*_bulk()` functions\n\n Should be initialized with `{0}` (or `memset()` to all zeros).\n Callers should treat it as an opaque type.\n\n A context may only be used with a single bitmap\n (unless re-initialized to zero), and any modification to a bitmap\n (other than modifications performed with `_bulk()` functions with the context\n passed) will invalidate any contexts associated with that bitmap."]
500#[repr(C)]
501#[derive(Debug, Copy, Clone)]
502pub struct roaring_bulk_context_s {
503    pub container: *mut ::core::ffi::c_void,
504    pub idx: ::core::ffi::c_int,
505    pub key: u16,
506    pub typecode: u8,
507}
508#[doc = " A bit of context usable with `roaring_bitmap_*_bulk()` functions\n\n Should be initialized with `{0}` (or `memset()` to all zeros).\n Callers should treat it as an opaque type.\n\n A context may only be used with a single bitmap\n (unless re-initialized to zero), and any modification to a bitmap\n (other than modifications performed with `_bulk()` functions with the context\n passed) will invalidate any contexts associated with that bitmap."]
509pub type roaring_bulk_context_t = roaring_bulk_context_s;
510extern "C" {
511    #[doc = " Add an item, using context from a previous insert for speed optimization.\n\n `context` will be used to store information between calls to make bulk\n operations faster. `*context` should be zero-initialized before the first\n call to this function.\n\n Modifying the bitmap in any way (other than `-bulk` suffixed functions)\n will invalidate the stored context, calling this function with a non-zero\n context after doing any modification invokes undefined behavior.\n\n In order to exploit this optimization, the caller should call this function\n with values with the same \"key\" (high 16 bits of the value) consecutively."]
512    pub fn roaring_bitmap_add_bulk(
513        r: *mut roaring_bitmap_t,
514        context: *mut roaring_bulk_context_t,
515        val: u32,
516    );
517}
518extern "C" {
519    #[doc = " Add value n_args from pointer vals, faster than repeatedly calling\n `roaring_bitmap_add()`\n\n In order to exploit this optimization, the caller should attempt to keep\n values with the same \"key\" (high 16 bits of the value) as consecutive\n elements in `vals`"]
520    pub fn roaring_bitmap_add_many(r: *mut roaring_bitmap_t, n_args: usize, vals: *const u32);
521}
522extern "C" {
523    #[doc = " Add value x"]
524    pub fn roaring_bitmap_add(r: *mut roaring_bitmap_t, x: u32);
525}
526extern "C" {
527    #[doc = " Add value x\n Returns true if a new value was added, false if the value already existed."]
528    pub fn roaring_bitmap_add_checked(r: *mut roaring_bitmap_t, x: u32) -> bool;
529}
530extern "C" {
531    #[doc = " Add all values in range [min, max]"]
532    pub fn roaring_bitmap_add_range_closed(r: *mut roaring_bitmap_t, min: u32, max: u32);
533}
534extern "C" {
535    #[doc = " Add all values in range [min, max)"]
536    pub fn roaring_bitmap_add_range(r: *mut roaring_bitmap_t, min: u64, max: u64);
537}
538extern "C" {
539    #[doc = " Remove value x"]
540    pub fn roaring_bitmap_remove(r: *mut roaring_bitmap_t, x: u32);
541}
542extern "C" {
543    #[doc = " Remove all values in range [min, max]"]
544    pub fn roaring_bitmap_remove_range_closed(r: *mut roaring_bitmap_t, min: u32, max: u32);
545}
546extern "C" {
547    #[doc = " Remove all values in range [min, max)"]
548    pub fn roaring_bitmap_remove_range(r: *mut roaring_bitmap_t, min: u64, max: u64);
549}
550extern "C" {
551    #[doc = " Remove multiple values"]
552    pub fn roaring_bitmap_remove_many(r: *mut roaring_bitmap_t, n_args: usize, vals: *const u32);
553}
554extern "C" {
555    #[doc = " Remove value x\n Returns true if a new value was removed, false if the value was not existing."]
556    pub fn roaring_bitmap_remove_checked(r: *mut roaring_bitmap_t, x: u32) -> bool;
557}
558extern "C" {
559    #[doc = " Check if value is present"]
560    pub fn roaring_bitmap_contains(r: *const roaring_bitmap_t, val: u32) -> bool;
561}
562extern "C" {
563    #[doc = " Check whether a range of values from range_start (included)\n to range_end (excluded) is present"]
564    pub fn roaring_bitmap_contains_range(
565        r: *const roaring_bitmap_t,
566        range_start: u64,
567        range_end: u64,
568    ) -> bool;
569}
570extern "C" {
571    #[doc = " Check whether a range of values from range_start (included)\n to range_end (included) is present"]
572    pub fn roaring_bitmap_contains_range_closed(
573        r: *const roaring_bitmap_t,
574        range_start: u32,
575        range_end: u32,
576    ) -> bool;
577}
578extern "C" {
579    #[doc = " Check if an items is present, using context from a previous insert or search\n for speed optimization.\n\n `context` will be used to store information between calls to make bulk\n operations faster. `*context` should be zero-initialized before the first\n call to this function.\n\n Modifying the bitmap in any way (other than `-bulk` suffixed functions)\n will invalidate the stored context, calling this function with a non-zero\n context after doing any modification invokes undefined behavior.\n\n In order to exploit this optimization, the caller should call this function\n with values with the same \"key\" (high 16 bits of the value) consecutively."]
580    pub fn roaring_bitmap_contains_bulk(
581        r: *const roaring_bitmap_t,
582        context: *mut roaring_bulk_context_t,
583        val: u32,
584    ) -> bool;
585}
586extern "C" {
587    #[doc = " Get the cardinality of the bitmap (number of elements)."]
588    pub fn roaring_bitmap_get_cardinality(r: *const roaring_bitmap_t) -> u64;
589}
590extern "C" {
591    #[doc = " Returns the number of elements in the range [range_start, range_end)."]
592    pub fn roaring_bitmap_range_cardinality(
593        r: *const roaring_bitmap_t,
594        range_start: u64,
595        range_end: u64,
596    ) -> u64;
597}
598extern "C" {
599    #[doc = " Returns the number of elements in the range [range_start, range_end]."]
600    pub fn roaring_bitmap_range_cardinality_closed(
601        r: *const roaring_bitmap_t,
602        range_start: u32,
603        range_end: u32,
604    ) -> u64;
605}
606extern "C" {
607    #[doc = " Returns true if the bitmap is empty (cardinality is zero)."]
608    pub fn roaring_bitmap_is_empty(r: *const roaring_bitmap_t) -> bool;
609}
610extern "C" {
611    #[doc = " Empties the bitmap.  It will have no auxiliary allocations (so if the bitmap\n was initialized in client memory via roaring_bitmap_init(), then a call to\n roaring_bitmap_clear() would be enough to \"free\" it)"]
612    pub fn roaring_bitmap_clear(r: *mut roaring_bitmap_t);
613}
614extern "C" {
615    #[doc = " Convert the bitmap to a sorted array, output in `ans`.\n\n Caller is responsible to ensure that there is enough memory allocated, e.g.\n\n     ans = malloc(roaring_bitmap_get_cardinality(bitmap) * sizeof(uint32_t));"]
616    pub fn roaring_bitmap_to_uint32_array(r: *const roaring_bitmap_t, ans: *mut u32);
617}
618extern "C" {
619    #[doc = " Store the bitmap to a bitset. This can be useful for people\n who need the performance and simplicity of a standard bitset.\n We assume that the input bitset is originally empty (does not\n have any set bit).\n\n   bitset_t * out = bitset_create();\n   // if the bitset has content in it, call \"bitset_clear(out)\"\n   bool success = roaring_bitmap_to_bitset(mybitmap, out);\n   // on failure, success will be false.\n   // You can then query the bitset:\n   bool is_present = bitset_get(out,  10011 );\n   // you must free the memory:\n   bitset_free(out);\n"]
620    pub fn roaring_bitmap_to_bitset(r: *const roaring_bitmap_t, bitset: *mut bitset_t) -> bool;
621}
622extern "C" {
623    #[doc = " Convert the bitmap to a sorted array from `offset` by `limit`, output in\n `ans`.\n\n Caller is responsible to ensure that there is enough memory allocated, e.g.\n\n     ans = malloc(roaring_bitmap_get_cardinality(limit) * sizeof(uint32_t));\n\n This function always returns `true`\n\n For more control, see `roaring_uint32_iterator_skip` and\n `roaring_uint32_iterator_read`, which can be used to e.g. tell how many\n values were actually read."]
624    pub fn roaring_bitmap_range_uint32_array(
625        r: *const roaring_bitmap_t,
626        offset: usize,
627        limit: usize,
628        ans: *mut u32,
629    ) -> bool;
630}
631extern "C" {
632    #[doc = " Remove run-length encoding even when it is more space efficient.\n Return whether a change was applied."]
633    pub fn roaring_bitmap_remove_run_compression(r: *mut roaring_bitmap_t) -> bool;
634}
635extern "C" {
636    #[doc = " Convert array and bitmap containers to run containers when it is more\n efficient; also convert from run containers when more space efficient.\n\n Returns true if the result has at least one run container.\n Additional savings might be possible by calling `shrinkToFit()`."]
637    pub fn roaring_bitmap_run_optimize(r: *mut roaring_bitmap_t) -> bool;
638}
639extern "C" {
640    #[doc = " If needed, reallocate memory to shrink the memory usage.\n Returns the number of bytes saved."]
641    pub fn roaring_bitmap_shrink_to_fit(r: *mut roaring_bitmap_t) -> usize;
642}
643extern "C" {
644    #[doc = " Write the bitmap to an output pointer, this output buffer should refer to\n at least `roaring_bitmap_size_in_bytes(r)` allocated bytes.\n\n See `roaring_bitmap_portable_serialize()` if you want a format that's\n compatible with Java and Go implementations.  This format can sometimes be\n more space efficient than the portable form, e.g. when the data is sparse.\n\n Returns how many bytes written, should be `roaring_bitmap_size_in_bytes(r)`.\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n When serializing data to a file, we recommend that you also use\n checksums so that, at deserialization, you can be confident\n that you are recovering the correct data."]
645    pub fn roaring_bitmap_serialize(
646        r: *const roaring_bitmap_t,
647        buf: *mut ::core::ffi::c_char,
648    ) -> usize;
649}
650extern "C" {
651    #[doc = " Use with `roaring_bitmap_serialize()`.\n\n (See `roaring_bitmap_portable_deserialize()` if you want a format that's\n compatible with Java and Go implementations).\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n The returned pointer may be NULL in case of errors."]
652    pub fn roaring_bitmap_deserialize(buf: *const ::core::ffi::c_void) -> *mut roaring_bitmap_t;
653}
654extern "C" {
655    #[doc = " Use with `roaring_bitmap_serialize()`.\n\n (See `roaring_bitmap_portable_deserialize_safe()` if you want a format that's\n compatible with Java and Go implementations).\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n The difference with `roaring_bitmap_deserialize()` is that this function\n checks that the input buffer is a valid bitmap.  If the buffer is too small,\n NULL is returned.\n\n The returned pointer may be NULL in case of errors."]
656    pub fn roaring_bitmap_deserialize_safe(
657        buf: *const ::core::ffi::c_void,
658        maxbytes: usize,
659    ) -> *mut roaring_bitmap_t;
660}
661extern "C" {
662    #[doc = " How many bytes are required to serialize this bitmap (NOT compatible\n with Java and Go versions)"]
663    pub fn roaring_bitmap_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
664}
665extern "C" {
666    #[doc = " Read bitmap from a serialized buffer.\n In case of failure, NULL is returned.\n\n This function is unsafe in the sense that if there is no valid serialized\n bitmap at the pointer, then many bytes could be read, possibly causing a\n buffer overflow.  See also roaring_bitmap_portable_deserialize_safe().\n\n This is meant to be compatible with the Java and Go versions:\n https://github.com/RoaringBitmap/RoaringFormatSpec\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n The returned pointer may be NULL in case of errors."]
667    pub fn roaring_bitmap_portable_deserialize(
668        buf: *const ::core::ffi::c_char,
669    ) -> *mut roaring_bitmap_t;
670}
671extern "C" {
672    #[doc = " Read bitmap from a serialized buffer safely (reading up to maxbytes).\n In case of failure, NULL is returned.\n\n This is meant to be compatible with the Java and Go versions:\n https://github.com/RoaringBitmap/RoaringFormatSpec\n\n The function itself is safe in the sense that it will not cause buffer\n overflows: it will not read beyond the scope of the provided buffer\n (buf,maxbytes).\n\n However, for correct operations, it is assumed that the bitmap\n read was once serialized from a valid bitmap (i.e., it follows the format\n specification). If you provided an incorrect input (garbage), then the bitmap\n read may not be in a valid state and following operations may not lead to\n sensible results. In particular, the serialized array containers need to be\n in sorted order, and the run containers should be in sorted non-overlapping\n order. This is is guaranteed to happen when serializing an existing bitmap,\n but not for random inputs.\n\n If the source is untrusted, you should call\n roaring_bitmap_internal_validate to check the validity of the\n bitmap prior to using it. Only after calling roaring_bitmap_internal_validate\n is the bitmap considered safe for use.\n\n We also recommend that you use checksums to check that serialized data\n corresponds to the serialized bitmap. The CRoaring library does not provide\n checksumming.\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n The returned pointer may be NULL in case of errors."]
673    pub fn roaring_bitmap_portable_deserialize_safe(
674        buf: *const ::core::ffi::c_char,
675        maxbytes: usize,
676    ) -> *mut roaring_bitmap_t;
677}
678extern "C" {
679    #[doc = " Read bitmap from a serialized buffer.\n In case of failure, NULL is returned.\n\n Bitmap returned by this function can be used in all readonly contexts.\n Bitmap must be freed as usual, by calling roaring_bitmap_free().\n Underlying buffer must not be freed or modified while it backs any bitmaps.\n\n The function is unsafe in the following ways:\n 1) It may execute unaligned memory accesses.\n 2) A buffer overflow may occur if buf does not point to a valid serialized\n    bitmap.\n\n This is meant to be compatible with the Java and Go versions:\n https://github.com/RoaringBitmap/RoaringFormatSpec\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n The returned pointer may be NULL in case of errors."]
680    pub fn roaring_bitmap_portable_deserialize_frozen(
681        buf: *const ::core::ffi::c_char,
682    ) -> *mut roaring_bitmap_t;
683}
684extern "C" {
685    #[doc = " Check how many bytes would be read (up to maxbytes) at this pointer if there\n is a bitmap, returns zero if there is no valid bitmap.\n\n This is meant to be compatible with the Java and Go versions:\n https://github.com/RoaringBitmap/RoaringFormatSpec"]
686    pub fn roaring_bitmap_portable_deserialize_size(
687        buf: *const ::core::ffi::c_char,
688        maxbytes: usize,
689    ) -> usize;
690}
691extern "C" {
692    #[doc = " How many bytes are required to serialize this bitmap.\n\n This is meant to be compatible with the Java and Go versions:\n https://github.com/RoaringBitmap/RoaringFormatSpec"]
693    pub fn roaring_bitmap_portable_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
694}
695extern "C" {
696    #[doc = " Write a bitmap to a char buffer.  The output buffer should refer to at least\n `roaring_bitmap_portable_size_in_bytes(r)` bytes of allocated memory.\n\n Returns how many bytes were written which should match\n `roaring_bitmap_portable_size_in_bytes(r)`.\n\n This is meant to be compatible with the Java and Go versions:\n https://github.com/RoaringBitmap/RoaringFormatSpec\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n When serializing data to a file, we recommend that you also use\n checksums so that, at deserialization, you can be confident\n that you are recovering the correct data."]
697    pub fn roaring_bitmap_portable_serialize(
698        r: *const roaring_bitmap_t,
699        buf: *mut ::core::ffi::c_char,
700    ) -> usize;
701}
702extern "C" {
703    #[doc = " Returns number of bytes required to serialize bitmap using frozen format."]
704    pub fn roaring_bitmap_frozen_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
705}
706extern "C" {
707    #[doc = " Serializes bitmap using frozen format.\n Buffer size must be at least roaring_bitmap_frozen_size_in_bytes().\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n When serializing data to a file, we recommend that you also use\n checksums so that, at deserialization, you can be confident\n that you are recovering the correct data."]
708    pub fn roaring_bitmap_frozen_serialize(
709        r: *const roaring_bitmap_t,
710        buf: *mut ::core::ffi::c_char,
711    );
712}
713extern "C" {
714    #[doc = " Creates constant bitmap that is a view of a given buffer.\n Buffer data should have been written by `roaring_bitmap_frozen_serialize()`\n Its beginning must also be aligned by 32 bytes.\n Length must be equal exactly to `roaring_bitmap_frozen_size_in_bytes()`.\n In case of failure, NULL is returned.\n\n Bitmap returned by this function can be used in all readonly contexts.\n Bitmap must be freed as usual, by calling roaring_bitmap_free().\n Underlying buffer must not be freed or modified while it backs any bitmaps.\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems."]
715    pub fn roaring_bitmap_frozen_view(
716        buf: *const ::core::ffi::c_char,
717        length: usize,
718    ) -> *const roaring_bitmap_t;
719}
720extern "C" {
721    #[doc = " Iterate over the bitmap elements. The function iterator is called once for\n all the values with ptr (can be NULL) as the second parameter of each call.\n\n `roaring_iterator` is simply a pointer to a function that returns bool\n (true means that the iteration should continue while false means that it\n should stop), and takes (uint32_t,void*) as inputs.\n\n Returns true if the roaring_iterator returned true throughout (so that all\n data points were necessarily visited).\n\n Iteration is ordered: from the smallest to the largest elements."]
722    pub fn roaring_iterate(
723        r: *const roaring_bitmap_t,
724        iterator: roaring_iterator,
725        ptr: *mut ::core::ffi::c_void,
726    ) -> bool;
727}
728extern "C" {
729    pub fn roaring_iterate64(
730        r: *const roaring_bitmap_t,
731        iterator: roaring_iterator64,
732        high_bits: u64,
733        ptr: *mut ::core::ffi::c_void,
734    ) -> bool;
735}
736extern "C" {
737    #[doc = " Return true if the two bitmaps contain the same elements."]
738    pub fn roaring_bitmap_equals(r1: *const roaring_bitmap_t, r2: *const roaring_bitmap_t) -> bool;
739}
740extern "C" {
741    #[doc = " Return true if all the elements of r1 are also in r2."]
742    pub fn roaring_bitmap_is_subset(
743        r1: *const roaring_bitmap_t,
744        r2: *const roaring_bitmap_t,
745    ) -> bool;
746}
747extern "C" {
748    #[doc = " Return true if all the elements of r1 are also in r2, and r2 is strictly\n greater than r1."]
749    pub fn roaring_bitmap_is_strict_subset(
750        r1: *const roaring_bitmap_t,
751        r2: *const roaring_bitmap_t,
752    ) -> bool;
753}
754extern "C" {
755    #[doc = " (For expert users who seek high performance.)\n\n Computes the union between two bitmaps and returns new bitmap. The caller is\n responsible for memory management.\n\n The lazy version defers some computations such as the maintenance of the\n cardinality counts. Thus you must call `roaring_bitmap_repair_after_lazy()`\n after executing \"lazy\" computations.\n\n It is safe to repeatedly call roaring_bitmap_lazy_or_inplace on the result.\n\n `bitsetconversion` is a flag which determines whether container-container\n operations force a bitset conversion.\n\n The returned pointer may be NULL in case of errors."]
756    pub fn roaring_bitmap_lazy_or(
757        r1: *const roaring_bitmap_t,
758        r2: *const roaring_bitmap_t,
759        bitsetconversion: bool,
760    ) -> *mut roaring_bitmap_t;
761}
762extern "C" {
763    #[doc = " (For expert users who seek high performance.)\n\n Inplace version of roaring_bitmap_lazy_or, modifies r1.\n\n `bitsetconversion` is a flag which determines whether container-container\n operations force a bitset conversion."]
764    pub fn roaring_bitmap_lazy_or_inplace(
765        r1: *mut roaring_bitmap_t,
766        r2: *const roaring_bitmap_t,
767        bitsetconversion: bool,
768    );
769}
770extern "C" {
771    #[doc = " (For expert users who seek high performance.)\n\n Execute maintenance on a bitmap created from `roaring_bitmap_lazy_or()`\n or modified with `roaring_bitmap_lazy_or_inplace()`."]
772    pub fn roaring_bitmap_repair_after_lazy(r1: *mut roaring_bitmap_t);
773}
774extern "C" {
775    #[doc = " Computes the symmetric difference between two bitmaps and returns new bitmap.\n The caller is responsible for memory management.\n\n The lazy version defers some computations such as the maintenance of the\n cardinality counts. Thus you must call `roaring_bitmap_repair_after_lazy()`\n after executing \"lazy\" computations.\n\n It is safe to repeatedly call `roaring_bitmap_lazy_xor_inplace()` on\n the result.\n\n The returned pointer may be NULL in case of errors."]
776    pub fn roaring_bitmap_lazy_xor(
777        r1: *const roaring_bitmap_t,
778        r2: *const roaring_bitmap_t,
779    ) -> *mut roaring_bitmap_t;
780}
781extern "C" {
782    #[doc = " (For expert users who seek high performance.)\n\n Inplace version of roaring_bitmap_lazy_xor, modifies r1. r1 != r2"]
783    pub fn roaring_bitmap_lazy_xor_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
784}
785extern "C" {
786    #[doc = " Compute the negation of the bitmap in the interval [range_start, range_end).\n The number of negated values is range_end - range_start.\n Areas outside the range are passed through unchanged.\n The returned pointer may be NULL in case of errors."]
787    pub fn roaring_bitmap_flip(
788        r1: *const roaring_bitmap_t,
789        range_start: u64,
790        range_end: u64,
791    ) -> *mut roaring_bitmap_t;
792}
793extern "C" {
794    #[doc = " Compute the negation of the bitmap in the interval [range_start, range_end].\n The number of negated values is range_end - range_start + 1.\n Areas outside the range are passed through unchanged.\n The returned pointer may be NULL in case of errors."]
795    pub fn roaring_bitmap_flip_closed(
796        x1: *const roaring_bitmap_t,
797        range_start: u32,
798        range_end: u32,
799    ) -> *mut roaring_bitmap_t;
800}
801extern "C" {
802    #[doc = " compute (in place) the negation of the roaring bitmap within a specified\n interval: [range_start, range_end). The number of negated values is\n range_end - range_start.\n Areas outside the range are passed through unchanged."]
803    pub fn roaring_bitmap_flip_inplace(r1: *mut roaring_bitmap_t, range_start: u64, range_end: u64);
804}
805extern "C" {
806    #[doc = " compute (in place) the negation of the roaring bitmap within a specified\n interval: [range_start, range_end]. The number of negated values is\n range_end - range_start + 1.\n Areas outside the range are passed through unchanged."]
807    pub fn roaring_bitmap_flip_inplace_closed(
808        r1: *mut roaring_bitmap_t,
809        range_start: u32,
810        range_end: u32,
811    );
812}
813extern "C" {
814    #[doc = " Selects the element at index 'rank' where the smallest element is at index 0.\n If the size of the roaring bitmap is strictly greater than rank, then this\n function returns true and sets element to the element of given rank.\n Otherwise, it returns false."]
815    pub fn roaring_bitmap_select(r: *const roaring_bitmap_t, rank: u32, element: *mut u32) -> bool;
816}
817extern "C" {
818    #[doc = " roaring_bitmap_rank returns the number of integers that are smaller or equal\n to x. Thus if x is the first element, this function will return 1. If\n x is smaller than the smallest element, this function will return 0.\n\n The indexing convention differs between roaring_bitmap_select and\n roaring_bitmap_rank: roaring_bitmap_select refers to the smallest value\n as having index 0, whereas roaring_bitmap_rank returns 1 when ranking\n the smallest value."]
819    pub fn roaring_bitmap_rank(r: *const roaring_bitmap_t, x: u32) -> u64;
820}
821extern "C" {
822    #[doc = " roaring_bitmap_rank_many is an `Bulk` version of `roaring_bitmap_rank`\n it puts rank value of each element in `[begin .. end)` to `ans[]`\n\n the values in `[begin .. end)` must be sorted in Ascending order;\n Caller is responsible to ensure that there is enough memory allocated, e.g.\n\n     ans = malloc((end-begin) * sizeof(uint64_t));"]
823    pub fn roaring_bitmap_rank_many(
824        r: *const roaring_bitmap_t,
825        begin: *const u32,
826        end: *const u32,
827        ans: *mut u64,
828    );
829}
830extern "C" {
831    #[doc = " Returns the index of x in the given roaring bitmap.\n If the roaring bitmap doesn't contain x , this function will return -1.\n The difference with rank function is that this function will return -1 when x\n is not the element of roaring bitmap, but the rank function will return a\n non-negative number."]
832    pub fn roaring_bitmap_get_index(r: *const roaring_bitmap_t, x: u32) -> i64;
833}
834extern "C" {
835    #[doc = " Returns the smallest value in the set, or UINT32_MAX if the set is empty."]
836    pub fn roaring_bitmap_minimum(r: *const roaring_bitmap_t) -> u32;
837}
838extern "C" {
839    #[doc = " Returns the greatest value in the set, or 0 if the set is empty."]
840    pub fn roaring_bitmap_maximum(r: *const roaring_bitmap_t) -> u32;
841}
842extern "C" {
843    #[doc = " (For advanced users.)\n\n Collect statistics about the bitmap, see roaring_types.h for\n a description of roaring_statistics_t"]
844    pub fn roaring_bitmap_statistics(r: *const roaring_bitmap_t, stat: *mut roaring_statistics_t);
845}
846extern "C" {
847    #[doc = " Perform internal consistency checks. Returns true if the bitmap is\n consistent. It may be useful to call this after deserializing bitmaps from\n untrusted sources. If roaring_bitmap_internal_validate returns true, then the\n bitmap should be consistent and can be trusted not to cause crashes or memory\n corruption.\n\n Note that some operations intentionally leave bitmaps in an inconsistent\n state temporarily, for example, `roaring_bitmap_lazy_*` functions, until\n `roaring_bitmap_repair_after_lazy` is called.\n\n If reason is non-null, it will be set to a string describing the first\n inconsistency found if any."]
848    pub fn roaring_bitmap_internal_validate(
849        r: *const roaring_bitmap_t,
850        reason: *mut *const ::core::ffi::c_char,
851    ) -> bool;
852}
853#[doc = " A struct used to keep iterator state. Users should only access\n `current_value` and `has_value`, the rest of the type should be treated as\n opaque."]
854#[repr(C)]
855#[derive(Debug, Copy, Clone)]
856pub struct roaring_uint32_iterator_s {
857    pub parent: *const roaring_bitmap_t,
858    pub container: *const ::core::ffi::c_void,
859    pub typecode: u8,
860    pub container_index: i32,
861    pub highbits: u32,
862    pub container_it: roaring_container_iterator_t,
863    pub current_value: u32,
864    pub has_value: bool,
865}
866#[doc = " A struct used to keep iterator state. Users should only access\n `current_value` and `has_value`, the rest of the type should be treated as\n opaque."]
867pub type roaring_uint32_iterator_t = roaring_uint32_iterator_s;
868extern "C" {
869    #[doc = " Initialize an iterator object that can be used to iterate through the values.\n If there is a  value, then this iterator points to the first value and\n `it->has_value` is true. The value is in `it->current_value`."]
870    pub fn roaring_iterator_init(r: *const roaring_bitmap_t, newit: *mut roaring_uint32_iterator_t);
871}
872extern "C" {
873    #[doc = " Initialize an iterator object that can be used to iterate through the values.\n If there is a value, then this iterator points to the last value and\n `it->has_value` is true. The value is in `it->current_value`."]
874    pub fn roaring_iterator_init_last(
875        r: *const roaring_bitmap_t,
876        newit: *mut roaring_uint32_iterator_t,
877    );
878}
879extern "C" {
880    #[doc = " Create an iterator object that can be used to iterate through the values.\n Caller is responsible for calling `roaring_uint32_iterator_free()`.\n\n The iterator is initialized (this function calls `roaring_iterator_init()`)\n If there is a value, then this iterator points to the first value and\n `it->has_value` is true.  The value is in `it->current_value`."]
881    pub fn roaring_iterator_create(r: *const roaring_bitmap_t) -> *mut roaring_uint32_iterator_t;
882}
883extern "C" {
884    #[doc = " Advance the iterator. If there is a new value, then `it->has_value` is true.\n The new value is in `it->current_value`. Values are traversed in increasing\n orders. For convenience, returns `it->has_value`.\n\n Once `it->has_value` is false, `roaring_uint32_iterator_advance` should not\n be called on the iterator again. Calling `roaring_uint32_iterator_previous`\n is allowed."]
885    pub fn roaring_uint32_iterator_advance(it: *mut roaring_uint32_iterator_t) -> bool;
886}
887extern "C" {
888    #[doc = " Decrement the iterator. If there's a new value, then `it->has_value` is true.\n The new value is in `it->current_value`. Values are traversed in decreasing\n order. For convenience, returns `it->has_value`.\n\n Once `it->has_value` is false, `roaring_uint32_iterator_previous` should not\n be called on the iterator again. Calling `roaring_uint32_iterator_advance` is\n allowed."]
889    pub fn roaring_uint32_iterator_previous(it: *mut roaring_uint32_iterator_t) -> bool;
890}
891extern "C" {
892    #[doc = " Move the iterator to the first value >= `val`. If there is a such a value,\n then `it->has_value` is true. The new value is in `it->current_value`.\n For convenience, returns `it->has_value`."]
893    pub fn roaring_uint32_iterator_move_equalorlarger(
894        it: *mut roaring_uint32_iterator_t,
895        val: u32,
896    ) -> bool;
897}
898extern "C" {
899    #[doc = " Creates a copy of an iterator.\n Caller must free it."]
900    pub fn roaring_uint32_iterator_copy(
901        it: *const roaring_uint32_iterator_t,
902    ) -> *mut roaring_uint32_iterator_t;
903}
904extern "C" {
905    #[doc = " Free memory following `roaring_iterator_create()`"]
906    pub fn roaring_uint32_iterator_free(it: *mut roaring_uint32_iterator_t);
907}
908extern "C" {
909    #[doc = " Reads next ${count} values from iterator into user-supplied ${buf}.\n Returns the number of read elements.\n This number can be smaller than ${count}, which means that iterator is\n drained.\n\n This function satisfies semantics of iteration and can be used together with\n other iterator functions.\n  - first value is copied from ${it}->current_value\n  - after function returns, iterator is positioned at the next element"]
910    pub fn roaring_uint32_iterator_read(
911        it: *mut roaring_uint32_iterator_t,
912        buf: *mut u32,
913        count: u32,
914    ) -> u32;
915}
916extern "C" {
917    #[doc = " Skip the next ${count} values from iterator.\n Returns the number of values actually skipped.\n The number can be smaller than ${count}, which means that iterator is\n drained.\n\n This function is equivalent to calling `roaring_uint32_iterator_advance()`\n ${count} times but is much more efficient."]
918    pub fn roaring_uint32_iterator_skip(it: *mut roaring_uint32_iterator_t, count: u32) -> u32;
919}
920extern "C" {
921    #[doc = " Skip the previous ${count} values from iterator (move backwards).\n Returns the number of values actually skipped backwards.\n The number can be smaller than ${count}, which means that iterator reached\n the beginning.\n\n This function is equivalent to calling `roaring_uint32_iterator_previous()`\n ${count} times but is much more efficient."]
922    pub fn roaring_uint32_iterator_skip_backward(
923        it: *mut roaring_uint32_iterator_t,
924        count: u32,
925    ) -> u32;
926}
927pub type roaring_malloc_p =
928    ::core::option::Option<unsafe extern "C" fn(arg1: usize) -> *mut ::core::ffi::c_void>;
929pub type roaring_realloc_p = ::core::option::Option<
930    unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void, arg2: usize) -> *mut ::core::ffi::c_void,
931>;
932pub type roaring_calloc_p = ::core::option::Option<
933    unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
934>;
935pub type roaring_free_p =
936    ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>;
937pub type roaring_aligned_malloc_p = ::core::option::Option<
938    unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
939>;
940pub type roaring_aligned_free_p =
941    ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>;
942#[repr(C)]
943#[derive(Debug, Copy, Clone)]
944pub struct roaring_memory_s {
945    pub malloc: roaring_malloc_p,
946    pub realloc: roaring_realloc_p,
947    pub calloc: roaring_calloc_p,
948    pub free: roaring_free_p,
949    pub aligned_malloc: roaring_aligned_malloc_p,
950    pub aligned_free: roaring_aligned_free_p,
951}
952pub type roaring_memory_t = roaring_memory_s;
953extern "C" {
954    pub fn roaring_init_memory_hook(memory_hook: roaring_memory_t);
955}
956extern "C" {
957    pub fn roaring_malloc(arg1: usize) -> *mut ::core::ffi::c_void;
958}
959extern "C" {
960    pub fn roaring_realloc(arg1: *mut ::core::ffi::c_void, arg2: usize)
961        -> *mut ::core::ffi::c_void;
962}
963extern "C" {
964    pub fn roaring_calloc(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void;
965}
966extern "C" {
967    pub fn roaring_free(arg1: *mut ::core::ffi::c_void);
968}
969extern "C" {
970    pub fn roaring_aligned_malloc(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void;
971}
972extern "C" {
973    pub fn roaring_aligned_free(arg1: *mut ::core::ffi::c_void);
974}
975#[repr(C)]
976#[derive(Debug, Copy, Clone)]
977pub struct roaring64_bitmap_s {
978    _unused: [u8; 0],
979}
980pub type roaring64_bitmap_t = roaring64_bitmap_s;
981pub type roaring64_leaf_t = u64;
982#[repr(C)]
983#[derive(Debug, Copy, Clone)]
984pub struct roaring64_iterator_s {
985    _unused: [u8; 0],
986}
987pub type roaring64_iterator_t = roaring64_iterator_s;
988#[doc = " A bit of context usable with `roaring64_bitmap_*_bulk()` functions.\n\n Should be initialized with `{0}` (or `memset()` to all zeros).\n Callers should treat it as an opaque type.\n\n A context may only be used with a single bitmap (unless re-initialized to\n zero), and any modification to a bitmap (other than modifications performed\n with `_bulk()` functions with the context passed) will invalidate any\n contexts associated with that bitmap."]
989#[repr(C)]
990#[derive(Debug, Copy, Clone)]
991pub struct roaring64_bulk_context_s {
992    pub high_bytes: [u8; 6usize],
993    pub leaf: *mut roaring64_leaf_t,
994}
995#[doc = " A bit of context usable with `roaring64_bitmap_*_bulk()` functions.\n\n Should be initialized with `{0}` (or `memset()` to all zeros).\n Callers should treat it as an opaque type.\n\n A context may only be used with a single bitmap (unless re-initialized to\n zero), and any modification to a bitmap (other than modifications performed\n with `_bulk()` functions with the context passed) will invalidate any\n contexts associated with that bitmap."]
996pub type roaring64_bulk_context_t = roaring64_bulk_context_s;
997extern "C" {
998    #[doc = " Dynamically allocates a new bitmap (initially empty).\n Client is responsible for calling `roaring64_bitmap_free()`.\n The returned pointer may be NULL in case of errors."]
999    pub fn roaring64_bitmap_create() -> *mut roaring64_bitmap_t;
1000}
1001extern "C" {
1002    pub fn roaring64_bitmap_free(r: *mut roaring64_bitmap_t);
1003}
1004extern "C" {
1005    #[doc = " Returns a copy of a bitmap.\n The returned pointer may be NULL in case of errors."]
1006    pub fn roaring64_bitmap_copy(r: *const roaring64_bitmap_t) -> *mut roaring64_bitmap_t;
1007}
1008extern "C" {
1009    #[doc = " Creates a new bitmap of a pointer to N 64-bit integers."]
1010    pub fn roaring64_bitmap_of_ptr(n_args: usize, vals: *const u64) -> *mut roaring64_bitmap_t;
1011}
1012extern "C" {
1013    #[doc = " Create a new bitmap by moving containers from a 32 bit roaring bitmap.\n\n After calling this function, the original bitmap will be empty, and the\n returned bitmap will contain all the values from the original bitmap."]
1014    pub fn roaring64_bitmap_move_from_roaring32(
1015        r: *mut roaring_bitmap_t,
1016    ) -> *mut roaring64_bitmap_t;
1017}
1018extern "C" {
1019    #[doc = " Create a new bitmap containing all the values in [min, max) that are at a\n distance k*step from min.\n The returned pointer may be NULL in case of errors."]
1020    pub fn roaring64_bitmap_from_range(min: u64, max: u64, step: u64) -> *mut roaring64_bitmap_t;
1021}
1022extern "C" {
1023    #[doc = " Adds the provided value to the bitmap."]
1024    pub fn roaring64_bitmap_add(r: *mut roaring64_bitmap_t, val: u64);
1025}
1026extern "C" {
1027    #[doc = " Adds the provided value to the bitmap.\n Returns true if a new value was added, false if the value already existed."]
1028    pub fn roaring64_bitmap_add_checked(r: *mut roaring64_bitmap_t, val: u64) -> bool;
1029}
1030extern "C" {
1031    #[doc = " Add an item, using context from a previous insert for faster insertion.\n\n `context` will be used to store information between calls to make bulk\n operations faster. `*context` should be zero-initialized before the first\n call to this function.\n\n Modifying the bitmap in any way (other than `-bulk` suffixed functions)\n will invalidate the stored context, calling this function with a non-zero\n context after doing any modification invokes undefined behavior.\n\n In order to exploit this optimization, the caller should call this function\n with values with the same high 48 bits of the value consecutively."]
1032    pub fn roaring64_bitmap_add_bulk(
1033        r: *mut roaring64_bitmap_t,
1034        context: *mut roaring64_bulk_context_t,
1035        val: u64,
1036    );
1037}
1038extern "C" {
1039    #[doc = " Add `n_args` values from `vals`, faster than repeatedly calling\n `roaring64_bitmap_add()`\n\n In order to exploit this optimization, the caller should attempt to keep\n values with the same high 48 bits of the value as consecutive elements in\n `vals`."]
1040    pub fn roaring64_bitmap_add_many(r: *mut roaring64_bitmap_t, n_args: usize, vals: *const u64);
1041}
1042extern "C" {
1043    #[doc = " Add all values in range [min, max)."]
1044    pub fn roaring64_bitmap_add_range(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1045}
1046extern "C" {
1047    #[doc = " Add all values in range [min, max]."]
1048    pub fn roaring64_bitmap_add_range_closed(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1049}
1050extern "C" {
1051    #[doc = " Removes a value from the bitmap if present."]
1052    pub fn roaring64_bitmap_remove(r: *mut roaring64_bitmap_t, val: u64);
1053}
1054extern "C" {
1055    #[doc = " Removes a value from the bitmap if present, returns true if the value was\n removed and false if the value was not present."]
1056    pub fn roaring64_bitmap_remove_checked(r: *mut roaring64_bitmap_t, val: u64) -> bool;
1057}
1058extern "C" {
1059    #[doc = " Remove an item, using context from a previous insert for faster removal.\n\n `context` will be used to store information between calls to make bulk\n operations faster. `*context` should be zero-initialized before the first\n call to this function.\n\n Modifying the bitmap in any way (other than `-bulk` suffixed functions)\n will invalidate the stored context, calling this function with a non-zero\n context after doing any modification invokes undefined behavior.\n\n In order to exploit this optimization, the caller should call this function\n with values with the same high 48 bits of the value consecutively."]
1060    pub fn roaring64_bitmap_remove_bulk(
1061        r: *mut roaring64_bitmap_t,
1062        context: *mut roaring64_bulk_context_t,
1063        val: u64,
1064    );
1065}
1066extern "C" {
1067    #[doc = " Remove `n_args` values from `vals`, faster than repeatedly calling\n `roaring64_bitmap_remove()`\n\n In order to exploit this optimization, the caller should attempt to keep\n values with the same high 48 bits of the value as consecutive elements in\n `vals`."]
1068    pub fn roaring64_bitmap_remove_many(
1069        r: *mut roaring64_bitmap_t,
1070        n_args: usize,
1071        vals: *const u64,
1072    );
1073}
1074extern "C" {
1075    #[doc = " Remove all values in range [min, max)."]
1076    pub fn roaring64_bitmap_remove_range(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1077}
1078extern "C" {
1079    #[doc = " Remove all values in range [min, max]."]
1080    pub fn roaring64_bitmap_remove_range_closed(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1081}
1082extern "C" {
1083    #[doc = " Empties the bitmap."]
1084    pub fn roaring64_bitmap_clear(r: *mut roaring64_bitmap_t);
1085}
1086extern "C" {
1087    #[doc = " Returns true if the provided value is present."]
1088    pub fn roaring64_bitmap_contains(r: *const roaring64_bitmap_t, val: u64) -> bool;
1089}
1090extern "C" {
1091    #[doc = " Returns true if all values in the range [min, max) are present."]
1092    pub fn roaring64_bitmap_contains_range(
1093        r: *const roaring64_bitmap_t,
1094        min: u64,
1095        max: u64,
1096    ) -> bool;
1097}
1098extern "C" {
1099    #[doc = " Check if an item is present using context from a previous insert or search\n for faster search.\n\n `context` will be used to store information between calls to make bulk\n operations faster. `*context` should be zero-initialized before the first\n call to this function.\n\n Modifying the bitmap in any way (other than `-bulk` suffixed functions)\n will invalidate the stored context, calling this function with a non-zero\n context after doing any modification invokes undefined behavior.\n\n In order to exploit this optimization, the caller should call this function\n with values with the same high 48 bits of the value consecutively."]
1100    pub fn roaring64_bitmap_contains_bulk(
1101        r: *const roaring64_bitmap_t,
1102        context: *mut roaring64_bulk_context_t,
1103        val: u64,
1104    ) -> bool;
1105}
1106extern "C" {
1107    #[doc = " Selects the element at index 'rank' where the smallest element is at index 0.\n If the size of the bitmap is strictly greater than rank, then this function\n returns true and sets element to the element of given rank. Otherwise, it\n returns false."]
1108    pub fn roaring64_bitmap_select(
1109        r: *const roaring64_bitmap_t,
1110        rank: u64,
1111        element: *mut u64,
1112    ) -> bool;
1113}
1114extern "C" {
1115    #[doc = " Returns the number of integers that are smaller or equal to x. Thus if x is\n the first element, this function will return 1. If x is smaller than the\n smallest element, this function will return 0.\n\n The indexing convention differs between roaring64_bitmap_select and\n roaring64_bitmap_rank: roaring_bitmap64_select refers to the smallest value\n as having index 0, whereas roaring64_bitmap_rank returns 1 when ranking\n the smallest value."]
1116    pub fn roaring64_bitmap_rank(r: *const roaring64_bitmap_t, val: u64) -> u64;
1117}
1118extern "C" {
1119    #[doc = " Returns true if the given value is in the bitmap, and sets `out_index` to the\n (0-based) index of the value in the bitmap. Returns false if the value is not\n in the bitmap."]
1120    pub fn roaring64_bitmap_get_index(
1121        r: *const roaring64_bitmap_t,
1122        val: u64,
1123        out_index: *mut u64,
1124    ) -> bool;
1125}
1126extern "C" {
1127    #[doc = " Returns the number of values in the bitmap."]
1128    pub fn roaring64_bitmap_get_cardinality(r: *const roaring64_bitmap_t) -> u64;
1129}
1130extern "C" {
1131    #[doc = " Returns the number of elements in the range [min, max)."]
1132    pub fn roaring64_bitmap_range_cardinality(
1133        r: *const roaring64_bitmap_t,
1134        min: u64,
1135        max: u64,
1136    ) -> u64;
1137}
1138extern "C" {
1139    #[doc = " Returns the number of elements in the range [min, max]"]
1140    pub fn roaring64_bitmap_range_closed_cardinality(
1141        r: *const roaring64_bitmap_t,
1142        min: u64,
1143        max: u64,
1144    ) -> u64;
1145}
1146extern "C" {
1147    #[doc = " Returns true if the bitmap is empty (cardinality is zero)."]
1148    pub fn roaring64_bitmap_is_empty(r: *const roaring64_bitmap_t) -> bool;
1149}
1150extern "C" {
1151    #[doc = " Returns the smallest value in the set, or UINT64_MAX if the set is empty."]
1152    pub fn roaring64_bitmap_minimum(r: *const roaring64_bitmap_t) -> u64;
1153}
1154extern "C" {
1155    #[doc = " Returns the largest value in the set, or 0 if empty."]
1156    pub fn roaring64_bitmap_maximum(r: *const roaring64_bitmap_t) -> u64;
1157}
1158extern "C" {
1159    #[doc = " Returns true if the result has at least one run container."]
1160    pub fn roaring64_bitmap_run_optimize(r: *mut roaring64_bitmap_t) -> bool;
1161}
1162extern "C" {
1163    #[doc = " Shrinks internal arrays to eliminate any unused capacity. Returns the number\n of bytes freed."]
1164    pub fn roaring64_bitmap_shrink_to_fit(r: *mut roaring64_bitmap_t) -> usize;
1165}
1166extern "C" {
1167    #[doc = "  (For advanced users.)\n Collect statistics about the bitmap"]
1168    pub fn roaring64_bitmap_statistics(
1169        r: *const roaring64_bitmap_t,
1170        stat: *mut roaring64_statistics_t,
1171    );
1172}
1173extern "C" {
1174    #[doc = " Perform internal consistency checks.\n\n Returns true if the bitmap is consistent. It may be useful to call this\n after deserializing bitmaps from untrusted sources. If\n roaring64_bitmap_internal_validate returns true, then the bitmap is\n consistent and can be trusted not to cause crashes or memory corruption.\n\n If reason is non-null, it will be set to a string describing the first\n inconsistency found if any."]
1175    pub fn roaring64_bitmap_internal_validate(
1176        r: *const roaring64_bitmap_t,
1177        reason: *mut *const ::core::ffi::c_char,
1178    ) -> bool;
1179}
1180extern "C" {
1181    #[doc = " Return true if the two bitmaps contain the same elements."]
1182    pub fn roaring64_bitmap_equals(
1183        r1: *const roaring64_bitmap_t,
1184        r2: *const roaring64_bitmap_t,
1185    ) -> bool;
1186}
1187extern "C" {
1188    #[doc = " Return true if all the elements of r1 are also in r2."]
1189    pub fn roaring64_bitmap_is_subset(
1190        r1: *const roaring64_bitmap_t,
1191        r2: *const roaring64_bitmap_t,
1192    ) -> bool;
1193}
1194extern "C" {
1195    #[doc = " Return true if all the elements of r1 are also in r2, and r2 is strictly\n greater than r1."]
1196    pub fn roaring64_bitmap_is_strict_subset(
1197        r1: *const roaring64_bitmap_t,
1198        r2: *const roaring64_bitmap_t,
1199    ) -> bool;
1200}
1201extern "C" {
1202    #[doc = " Computes the intersection between two bitmaps and returns new bitmap. The\n caller is responsible for free-ing the result.\n\n Performance hint: if you are computing the intersection between several\n bitmaps, two-by-two, it is best to start with the smallest bitmaps. You may\n also rely on roaring64_bitmap_and_inplace to avoid creating many temporary\n bitmaps.\n\n The returned pointer may be NULL in case of errors."]
1203    pub fn roaring64_bitmap_and(
1204        r1: *const roaring64_bitmap_t,
1205        r2: *const roaring64_bitmap_t,
1206    ) -> *mut roaring64_bitmap_t;
1207}
1208extern "C" {
1209    #[doc = " Computes the size of the intersection between two bitmaps."]
1210    pub fn roaring64_bitmap_and_cardinality(
1211        r1: *const roaring64_bitmap_t,
1212        r2: *const roaring64_bitmap_t,
1213    ) -> u64;
1214}
1215extern "C" {
1216    #[doc = " In-place version of `roaring64_bitmap_and()`, modifies `r1`. `r1` and `r2`\n are allowed to be equal.\n\n Performance hint: if you are computing the intersection between several\n bitmaps, two-by-two, it is best to start with the smallest bitmaps."]
1217    pub fn roaring64_bitmap_and_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1218}
1219extern "C" {
1220    #[doc = " Check whether two bitmaps intersect."]
1221    pub fn roaring64_bitmap_intersect(
1222        r1: *const roaring64_bitmap_t,
1223        r2: *const roaring64_bitmap_t,
1224    ) -> bool;
1225}
1226extern "C" {
1227    #[doc = " Check whether a bitmap intersects the range [min, max)."]
1228    pub fn roaring64_bitmap_intersect_with_range(
1229        r: *const roaring64_bitmap_t,
1230        min: u64,
1231        max: u64,
1232    ) -> bool;
1233}
1234extern "C" {
1235    #[doc = " Computes the Jaccard index between two bitmaps. (Also known as the Tanimoto\n distance, or the Jaccard similarity coefficient)\n\n The Jaccard index is undefined if both bitmaps are empty."]
1236    pub fn roaring64_bitmap_jaccard_index(
1237        r1: *const roaring64_bitmap_t,
1238        r2: *const roaring64_bitmap_t,
1239    ) -> f64;
1240}
1241extern "C" {
1242    #[doc = " Computes the union between two bitmaps and returns new bitmap. The caller is\n responsible for free-ing the result.\n The returned pointer may be NULL in case of errors."]
1243    pub fn roaring64_bitmap_or(
1244        r1: *const roaring64_bitmap_t,
1245        r2: *const roaring64_bitmap_t,
1246    ) -> *mut roaring64_bitmap_t;
1247}
1248extern "C" {
1249    #[doc = " Computes the size of the union between two bitmaps."]
1250    pub fn roaring64_bitmap_or_cardinality(
1251        r1: *const roaring64_bitmap_t,
1252        r2: *const roaring64_bitmap_t,
1253    ) -> u64;
1254}
1255extern "C" {
1256    #[doc = " In-place version of `roaring64_bitmap_or(), modifies `r1`."]
1257    pub fn roaring64_bitmap_or_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1258}
1259extern "C" {
1260    #[doc = " Computes the symmetric difference (xor) between two bitmaps and returns a new\n bitmap. The caller is responsible for free-ing the result.\n The returned pointer may be NULL in case of errors."]
1261    pub fn roaring64_bitmap_xor(
1262        r1: *const roaring64_bitmap_t,
1263        r2: *const roaring64_bitmap_t,
1264    ) -> *mut roaring64_bitmap_t;
1265}
1266extern "C" {
1267    #[doc = " Computes the size of the symmetric difference (xor) between two bitmaps."]
1268    pub fn roaring64_bitmap_xor_cardinality(
1269        r1: *const roaring64_bitmap_t,
1270        r2: *const roaring64_bitmap_t,
1271    ) -> u64;
1272}
1273extern "C" {
1274    #[doc = " In-place version of `roaring64_bitmap_xor()`, modifies `r1`. `r1` and `r2`\n are not allowed to be equal (that would result in an empty bitmap)."]
1275    pub fn roaring64_bitmap_xor_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1276}
1277extern "C" {
1278    #[doc = " Computes the difference (andnot) between two bitmaps and returns a new\n bitmap. The caller is responsible for free-ing the result.\n The returned pointer may be NULL in case of errors."]
1279    pub fn roaring64_bitmap_andnot(
1280        r1: *const roaring64_bitmap_t,
1281        r2: *const roaring64_bitmap_t,
1282    ) -> *mut roaring64_bitmap_t;
1283}
1284extern "C" {
1285    #[doc = " Computes the size of the difference (andnot) between two bitmaps."]
1286    pub fn roaring64_bitmap_andnot_cardinality(
1287        r1: *const roaring64_bitmap_t,
1288        r2: *const roaring64_bitmap_t,
1289    ) -> u64;
1290}
1291extern "C" {
1292    #[doc = " In-place version of `roaring64_bitmap_andnot()`, modifies `r1`. `r1` and `r2`\n are not allowed to be equal (that would result in an empty bitmap)."]
1293    pub fn roaring64_bitmap_andnot_inplace(
1294        r1: *mut roaring64_bitmap_t,
1295        r2: *const roaring64_bitmap_t,
1296    );
1297}
1298extern "C" {
1299    #[doc = " Compute the negation of the bitmap in the interval [min, max).\n The number of negated values is `max - min`. Areas outside the range are\n passed through unchanged.\n The returned pointer may be NULL in case of errors."]
1300    pub fn roaring64_bitmap_flip(
1301        r: *const roaring64_bitmap_t,
1302        min: u64,
1303        max: u64,
1304    ) -> *mut roaring64_bitmap_t;
1305}
1306extern "C" {
1307    #[doc = " Compute the negation of the bitmap in the interval [min, max].\n The number of negated values is `max - min + 1`. Areas outside the range are\n passed through unchanged.\n The returned pointer may be NULL in case of errors."]
1308    pub fn roaring64_bitmap_flip_closed(
1309        r: *const roaring64_bitmap_t,
1310        min: u64,
1311        max: u64,
1312    ) -> *mut roaring64_bitmap_t;
1313}
1314extern "C" {
1315    #[doc = " In-place version of `roaring64_bitmap_flip`. Compute the negation of the\n bitmap in the interval [min, max). The number of negated values is `max -\n min`. Areas outside the range are passed through unchanged."]
1316    pub fn roaring64_bitmap_flip_inplace(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1317}
1318extern "C" {
1319    #[doc = " In-place version of `roaring64_bitmap_flip_closed`. Compute the negation of\n the bitmap in the interval [min, max]. The number of negated values is `max -\n min + 1`. Areas outside the range are passed through unchanged."]
1320    pub fn roaring64_bitmap_flip_closed_inplace(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1321}
1322extern "C" {
1323    #[doc = " How many bytes are required to serialize this bitmap.\n\n This is meant to be compatible with other languages:\n https://github.com/RoaringBitmap/RoaringFormatSpec#extension-for-64-bit-implementations"]
1324    pub fn roaring64_bitmap_portable_size_in_bytes(r: *const roaring64_bitmap_t) -> usize;
1325}
1326extern "C" {
1327    #[doc = " Write a bitmap to a buffer. The output buffer should refer to at least\n `roaring64_bitmap_portable_size_in_bytes(r)` bytes of allocated memory.\n\n Returns how many bytes were written, which should match\n `roaring64_bitmap_portable_size_in_bytes(r)`.\n\n This is meant to be compatible with other languages:\n https://github.com/RoaringBitmap/RoaringFormatSpec#extension-for-64-bit-implementations\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n When serializing data to a file, we recommend that you also use\n checksums so that, at deserialization, you can be confident\n that you are recovering the correct data."]
1328    pub fn roaring64_bitmap_portable_serialize(
1329        r: *const roaring64_bitmap_t,
1330        buf: *mut ::core::ffi::c_char,
1331    ) -> usize;
1332}
1333extern "C" {
1334    #[doc = " Check how many bytes would be read (up to maxbytes) at this pointer if there\n is a valid bitmap, returns zero if there is no valid bitmap.\n\n This is meant to be compatible with other languages\n https://github.com/RoaringBitmap/RoaringFormatSpec#extension-for-64-bit-implementations"]
1335    pub fn roaring64_bitmap_portable_deserialize_size(
1336        buf: *const ::core::ffi::c_char,
1337        maxbytes: usize,
1338    ) -> usize;
1339}
1340extern "C" {
1341    #[doc = " Read a bitmap from a serialized buffer (reading up to maxbytes).\n In case of failure, NULL is returned.\n\n This is meant to be compatible with other languages\n https://github.com/RoaringBitmap/RoaringFormatSpec#extension-for-64-bit-implementations\n\n The function itself is safe in the sense that it will not cause buffer\n overflows: it will not read beyond the scope of the provided buffer\n (buf,maxbytes).\n\n However, for correct operations, it is assumed that the bitmap\n read was once serialized from a valid bitmap (i.e., it follows the format\n specification). If you provided an incorrect input (garbage), then the bitmap\n read may not be in a valid state and following operations may not lead to\n sensible results. In particular, the serialized array containers need to be\n in sorted order, and the run containers should be in sorted non-overlapping\n order. This is is guaranteed to happen when serializing an existing bitmap,\n but not for random inputs.\n\n If the source is untrusted, you should call\n roaring64_bitmap_internal_validate to check the validity of the\n bitmap prior to using it. Only after calling\n roaring64_bitmap_internal_validate is the bitmap considered safe for use.\n\n We also recommend that you use checksums to check that serialized data\n corresponds to the serialized bitmap. The CRoaring library does not provide\n checksumming.\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems."]
1342    pub fn roaring64_bitmap_portable_deserialize_safe(
1343        buf: *const ::core::ffi::c_char,
1344        maxbytes: usize,
1345    ) -> *mut roaring64_bitmap_t;
1346}
1347extern "C" {
1348    #[doc = " Returns the number of bytes required to serialize this bitmap in a \"frozen\"\n format. This is not compatible with any other serialization formats.\n\n `roaring64_bitmap_shrink_to_fit()` must be called before this method."]
1349    pub fn roaring64_bitmap_frozen_size_in_bytes(r: *const roaring64_bitmap_t) -> usize;
1350}
1351extern "C" {
1352    #[doc = " Serializes the bitmap in a \"frozen\" format. The given buffer must be at least\n `roaring64_bitmap_frozen_size_in_bytes()` in size. Returns the number of\n bytes used for serialization.\n\n `roaring64_bitmap_shrink_to_fit()` must be called before this method.\n\n The frozen format is optimized for speed of (de)serialization, as well as\n allowing the user to create a bitmap based on a memory mapped file, which is\n possible because the format mimics the memory layout of the bitmap.\n\n Because the format mimics the memory layout of the bitmap, the format is not\n fixed across releases of Roaring Bitmaps, and may change in future releases.\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems."]
1353    pub fn roaring64_bitmap_frozen_serialize(
1354        r: *const roaring64_bitmap_t,
1355        buf: *mut ::core::ffi::c_char,
1356    ) -> usize;
1357}
1358extern "C" {
1359    #[doc = " Creates a readonly bitmap that is a view of the given buffer. The buffer\n must be created with `roaring64_bitmap_frozen_serialize()`, and must be\n aligned by 64 bytes.\n\n Returns NULL if deserialization fails.\n\n The returned bitmap must only be used in a readonly manner. The bitmap must\n be freed using `roaring64_bitmap_free()` as normal. The backing buffer must\n only be freed after the bitmap.\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems."]
1360    pub fn roaring64_bitmap_frozen_view(
1361        buf: *const ::core::ffi::c_char,
1362        maxbytes: usize,
1363    ) -> *mut roaring64_bitmap_t;
1364}
1365extern "C" {
1366    #[doc = " Iterate over the bitmap elements. The function `iterator` is called once for\n all the values with `ptr` (can be NULL) as the second parameter of each call.\n\n `roaring_iterator64` is simply a pointer to a function that returns a bool\n and takes `(uint64_t, void*)` as inputs. True means that the iteration should\n continue, while false means that it should stop.\n\n Returns true if the `roaring64_iterator` returned true throughout (so that\n all data points were necessarily visited).\n\n Iteration is ordered from the smallest to the largest elements."]
1367    pub fn roaring64_bitmap_iterate(
1368        r: *const roaring64_bitmap_t,
1369        iterator: roaring_iterator64,
1370        ptr: *mut ::core::ffi::c_void,
1371    ) -> bool;
1372}
1373extern "C" {
1374    #[doc = " Convert the bitmap to a sorted array `out`.\n\n Caller is responsible to ensure that there is enough memory allocated, e.g.\n ```\n out = malloc(roaring64_bitmap_get_cardinality(bitmap) * sizeof(uint64_t));\n ```"]
1375    pub fn roaring64_bitmap_to_uint64_array(r: *const roaring64_bitmap_t, out: *mut u64);
1376}
1377extern "C" {
1378    #[doc = " Create an iterator object that can be used to iterate through the values.\n Caller is responsible for calling `roaring64_iterator_free()`.\n\n The iterator is initialized. If there is a value, then this iterator points\n to the first value and `roaring64_iterator_has_value()` returns true. The\n value can be retrieved with `roaring64_iterator_value()`."]
1379    pub fn roaring64_iterator_create(r: *const roaring64_bitmap_t) -> *mut roaring64_iterator_t;
1380}
1381extern "C" {
1382    #[doc = " Create an iterator object that can be used to iterate through the values.\n Caller is responsible for calling `roaring64_iterator_free()`.\n\n The iterator is initialized. If there is a value, then this iterator points\n to the last value and `roaring64_iterator_has_value()` returns true. The\n value can be retrieved with `roaring64_iterator_value()`."]
1383    pub fn roaring64_iterator_create_last(
1384        r: *const roaring64_bitmap_t,
1385    ) -> *mut roaring64_iterator_t;
1386}
1387extern "C" {
1388    #[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create` without a allocation."]
1389    pub fn roaring64_iterator_reinit(r: *const roaring64_bitmap_t, it: *mut roaring64_iterator_t);
1390}
1391extern "C" {
1392    #[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create_last` without a allocation."]
1393    pub fn roaring64_iterator_reinit_last(
1394        r: *const roaring64_bitmap_t,
1395        it: *mut roaring64_iterator_t,
1396    );
1397}
1398extern "C" {
1399    #[doc = " Creates a copy of the iterator. Caller is responsible for calling\n `roaring64_iterator_free()` on the resulting iterator."]
1400    pub fn roaring64_iterator_copy(it: *const roaring64_iterator_t) -> *mut roaring64_iterator_t;
1401}
1402extern "C" {
1403    #[doc = " Free the iterator."]
1404    pub fn roaring64_iterator_free(it: *mut roaring64_iterator_t);
1405}
1406extern "C" {
1407    #[doc = " Returns true if the iterator currently points to a value. If so, calling\n `roaring64_iterator_value()` returns the value."]
1408    pub fn roaring64_iterator_has_value(it: *const roaring64_iterator_t) -> bool;
1409}
1410extern "C" {
1411    #[doc = " Returns the value the iterator currently points to. Should only be called if\n `roaring64_iterator_has_value()` returns true."]
1412    pub fn roaring64_iterator_value(it: *const roaring64_iterator_t) -> u64;
1413}
1414extern "C" {
1415    #[doc = " Advance the iterator. If there is a new value, then\n `roaring64_iterator_has_value()` returns true. Values are traversed in\n increasing order. For convenience, returns the result of\n `roaring64_iterator_has_value()`.\n\n Once this returns false, `roaring64_iterator_advance` should not be called on\n the iterator again. Calling `roaring64_iterator_previous` is allowed."]
1416    pub fn roaring64_iterator_advance(it: *mut roaring64_iterator_t) -> bool;
1417}
1418extern "C" {
1419    #[doc = " Decrement the iterator. If there is a new value, then\n `roaring64_iterator_has_value()` returns true. Values are traversed in\n decreasing order. For convenience, returns the result of\n `roaring64_iterator_has_value()`.\n\n Once this returns false, `roaring64_iterator_previous` should not be called\n on the iterator again. Calling `roaring64_iterator_advance` is allowed."]
1420    pub fn roaring64_iterator_previous(it: *mut roaring64_iterator_t) -> bool;
1421}
1422extern "C" {
1423    #[doc = " Move the iterator to the first value greater than or equal to `val`, if it\n exists at or after the current position of the iterator. If there is a new\n value, then `roaring64_iterator_has_value()` returns true. Values are\n traversed in increasing order. For convenience, returns the result of\n `roaring64_iterator_has_value()`."]
1424    pub fn roaring64_iterator_move_equalorlarger(it: *mut roaring64_iterator_t, val: u64) -> bool;
1425}
1426extern "C" {
1427    #[doc = " Reads up to `count` values from the iterator into the given `buf`. Returns\n the number of elements read. The number of elements read can be smaller than\n `count`, which means that there are no more elements in the bitmap.\n\n This function can be used together with other iterator functions."]
1428    pub fn roaring64_iterator_read(it: *mut roaring64_iterator_t, buf: *mut u64, count: u64)
1429        -> u64;
1430}