Skip to main content

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.7.0\0";
4pub const ROARING_VERSION_MAJOR: _bindgen_ty_1 = 4;
5pub const ROARING_VERSION_MINOR: _bindgen_ty_1 = 7;
6pub const ROARING_VERSION_REVISION: _bindgen_ty_1 = 0;
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. In other words, this routine assumes that `buf` points to a\n complete, correctly formatted serialized bitmap and does not take a buffer\n length argument that would let it enforce a read bound.\n\n Use this function only when the input buffer is already trusted, for example\n because it comes from memory that was previously filled by\n `roaring_bitmap_portable_serialize()` and whose size is known by some other\n means. If the source is untrusted, truncated, or otherwise not guaranteed to\n contain a valid serialized bitmap, prefer\n `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 = " Reads previous ${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 Values are written in descending order: buf[0] is the highest (current)\n value, buf[ret-1] is the lowest value read.\n\n This function satisfies semantics of reverse iteration and can be used\n together with other iterator functions.\n  - first value is copied from ${it}->current_value\n  - after function returns, iterator is positioned at the previous element"]
918    pub fn roaring_uint32_iterator_read_backward(
919        it: *mut roaring_uint32_iterator_t,
920        buf: *mut u32,
921        count: u32,
922    ) -> u32;
923}
924extern "C" {
925    #[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."]
926    pub fn roaring_uint32_iterator_skip(it: *mut roaring_uint32_iterator_t, count: u32) -> u32;
927}
928extern "C" {
929    #[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."]
930    pub fn roaring_uint32_iterator_skip_backward(
931        it: *mut roaring_uint32_iterator_t,
932        count: u32,
933    ) -> u32;
934}
935#[repr(C)]
936#[derive(Debug, Copy, Clone)]
937pub struct roaring_uint32_range_closed_s {
938    pub min: u32,
939    pub max: u32,
940}
941pub type roaring_uint32_range_closed_t = roaring_uint32_range_closed_s;
942extern "C" {
943    #[doc = " Reads next ${count} ranges from iterator into user-supplied ${buf}.\n A range is defined as a maximal interval of consecutive values.\n For example, the set {1,2,3,5,6} contains two ranges: [1..3] and [5..6].\n Each range is represented as a struct {min,max}, both endpoints included.\n Consecutive values that span internal container boundaries are merged into\n a single range.\n\n Returns the number of read ranges.\n This number can be smaller than ${count}, which means that the iterator is\n drained.\n\n This function satisfies the semantics of iteration and can be used together\n with other iterator functions.\n  - first range will start with ${it}->current_value\n  - after the function returns, the iterator is positioned at the next element\n    after the end of the last returned range, or ${it}->has_value is false if\n    the bitmap is exhausted."]
944    pub fn roaring_uint32_iterator_read_ranges(
945        it: *mut roaring_uint32_iterator_t,
946        buf: *mut roaring_uint32_range_closed_t,
947        count: usize,
948    ) -> usize;
949}
950extern "C" {
951    #[doc = " Reads previous ${count} ranges from iterator into user-supplied ${buf}.\n A range is defined as a maximal interval of consecutive values.\n For example, the set {1,2,3,5,6} contains two ranges: [1..3] and [5..6].\n Each range is represented as a struct {min,max}, both endpoints included.\n Consecutive values that span internal container boundaries are merged into\n a single range.\n\n Returns the number of read ranges.\n This number can be smaller than ${count}, which means that the iterator is\n drained.\n\n Ranges are returned in reverse order, e.g. the first range returned is the\n highest range (ending at the current value)\n\n This function satisfies the semantics of reverse iteration and can be used\n together with other iterator functions.\n  - first range will end with ${it}->current_value\n  - after the function returns, the iterator is positioned at the element\n    before the beginning of the last returned range, or ${it}->has_value is\n    false if the bitmap is exhausted."]
952    pub fn roaring_uint32_iterator_read_prev_ranges(
953        it: *mut roaring_uint32_iterator_t,
954        buf: *mut roaring_uint32_range_closed_t,
955        count: usize,
956    ) -> usize;
957}
958pub type roaring_malloc_p =
959    ::core::option::Option<unsafe extern "C" fn(arg1: usize) -> *mut ::core::ffi::c_void>;
960pub type roaring_realloc_p = ::core::option::Option<
961    unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void, arg2: usize) -> *mut ::core::ffi::c_void,
962>;
963pub type roaring_calloc_p = ::core::option::Option<
964    unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
965>;
966pub type roaring_free_p =
967    ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>;
968pub type roaring_aligned_malloc_p = ::core::option::Option<
969    unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
970>;
971pub type roaring_aligned_free_p =
972    ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>;
973#[repr(C)]
974#[derive(Debug, Copy, Clone)]
975pub struct roaring_memory_s {
976    pub malloc: roaring_malloc_p,
977    pub realloc: roaring_realloc_p,
978    pub calloc: roaring_calloc_p,
979    pub free: roaring_free_p,
980    pub aligned_malloc: roaring_aligned_malloc_p,
981    pub aligned_free: roaring_aligned_free_p,
982}
983pub type roaring_memory_t = roaring_memory_s;
984extern "C" {
985    pub fn roaring_init_memory_hook(memory_hook: roaring_memory_t);
986}
987extern "C" {
988    pub fn roaring_malloc(arg1: usize) -> *mut ::core::ffi::c_void;
989}
990extern "C" {
991    pub fn roaring_realloc(arg1: *mut ::core::ffi::c_void, arg2: usize)
992        -> *mut ::core::ffi::c_void;
993}
994extern "C" {
995    pub fn roaring_calloc(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void;
996}
997extern "C" {
998    pub fn roaring_free(arg1: *mut ::core::ffi::c_void);
999}
1000extern "C" {
1001    pub fn roaring_aligned_malloc(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void;
1002}
1003extern "C" {
1004    pub fn roaring_aligned_free(arg1: *mut ::core::ffi::c_void);
1005}
1006#[repr(C)]
1007#[derive(Debug, Copy, Clone)]
1008pub struct roaring64_bitmap_s {
1009    _unused: [u8; 0],
1010}
1011pub type roaring64_bitmap_t = roaring64_bitmap_s;
1012pub type roaring64_leaf_t = u64;
1013#[repr(C)]
1014#[derive(Debug, Copy, Clone)]
1015pub struct roaring64_iterator_s {
1016    _unused: [u8; 0],
1017}
1018pub type roaring64_iterator_t = roaring64_iterator_s;
1019#[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."]
1020#[repr(C)]
1021#[derive(Debug, Copy, Clone)]
1022pub struct roaring64_bulk_context_s {
1023    pub high_bytes: [u8; 6usize],
1024    pub leaf: *mut roaring64_leaf_t,
1025}
1026#[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."]
1027pub type roaring64_bulk_context_t = roaring64_bulk_context_s;
1028extern "C" {
1029    #[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."]
1030    pub fn roaring64_bitmap_create() -> *mut roaring64_bitmap_t;
1031}
1032extern "C" {
1033    pub fn roaring64_bitmap_free(r: *mut roaring64_bitmap_t);
1034}
1035extern "C" {
1036    #[doc = " Returns a copy of a bitmap.\n The returned pointer may be NULL in case of errors."]
1037    pub fn roaring64_bitmap_copy(r: *const roaring64_bitmap_t) -> *mut roaring64_bitmap_t;
1038}
1039extern "C" {
1040    #[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 roaring64_bitmap_copy except\n that roaring64_bitmap_overwrite can save on memory allocations.\n"]
1041    pub fn roaring64_bitmap_overwrite(
1042        dest: *mut roaring64_bitmap_t,
1043        src: *const roaring64_bitmap_t,
1044    );
1045}
1046extern "C" {
1047    #[doc = " Creates a new bitmap of a pointer to N 64-bit integers."]
1048    pub fn roaring64_bitmap_of_ptr(n_args: usize, vals: *const u64) -> *mut roaring64_bitmap_t;
1049}
1050extern "C" {
1051    #[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."]
1052    pub fn roaring64_bitmap_move_from_roaring32(
1053        r: *mut roaring_bitmap_t,
1054    ) -> *mut roaring64_bitmap_t;
1055}
1056extern "C" {
1057    #[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."]
1058    pub fn roaring64_bitmap_from_range(min: u64, max: u64, step: u64) -> *mut roaring64_bitmap_t;
1059}
1060extern "C" {
1061    #[doc = " Adds the provided value to the bitmap."]
1062    pub fn roaring64_bitmap_add(r: *mut roaring64_bitmap_t, val: u64);
1063}
1064extern "C" {
1065    #[doc = " Adds the provided value to the bitmap.\n Returns true if a new value was added, false if the value already existed."]
1066    pub fn roaring64_bitmap_add_checked(r: *mut roaring64_bitmap_t, val: u64) -> bool;
1067}
1068extern "C" {
1069    #[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."]
1070    pub fn roaring64_bitmap_add_bulk(
1071        r: *mut roaring64_bitmap_t,
1072        context: *mut roaring64_bulk_context_t,
1073        val: u64,
1074    );
1075}
1076extern "C" {
1077    #[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`."]
1078    pub fn roaring64_bitmap_add_many(r: *mut roaring64_bitmap_t, n_args: usize, vals: *const u64);
1079}
1080extern "C" {
1081    #[doc = " Add all values in range [min, max)."]
1082    pub fn roaring64_bitmap_add_range(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1083}
1084extern "C" {
1085    #[doc = " Add all values in range [min, max]."]
1086    pub fn roaring64_bitmap_add_range_closed(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1087}
1088extern "C" {
1089    #[doc = " Removes a value from the bitmap if present."]
1090    pub fn roaring64_bitmap_remove(r: *mut roaring64_bitmap_t, val: u64);
1091}
1092extern "C" {
1093    #[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."]
1094    pub fn roaring64_bitmap_remove_checked(r: *mut roaring64_bitmap_t, val: u64) -> bool;
1095}
1096extern "C" {
1097    #[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."]
1098    pub fn roaring64_bitmap_remove_bulk(
1099        r: *mut roaring64_bitmap_t,
1100        context: *mut roaring64_bulk_context_t,
1101        val: u64,
1102    );
1103}
1104extern "C" {
1105    #[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`."]
1106    pub fn roaring64_bitmap_remove_many(
1107        r: *mut roaring64_bitmap_t,
1108        n_args: usize,
1109        vals: *const u64,
1110    );
1111}
1112extern "C" {
1113    #[doc = " Remove all values in range [min, max)."]
1114    pub fn roaring64_bitmap_remove_range(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1115}
1116extern "C" {
1117    #[doc = " Remove all values in range [min, max]."]
1118    pub fn roaring64_bitmap_remove_range_closed(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1119}
1120extern "C" {
1121    #[doc = " Empties the bitmap."]
1122    pub fn roaring64_bitmap_clear(r: *mut roaring64_bitmap_t);
1123}
1124extern "C" {
1125    #[doc = " Returns true if the provided value is present."]
1126    pub fn roaring64_bitmap_contains(r: *const roaring64_bitmap_t, val: u64) -> bool;
1127}
1128extern "C" {
1129    #[doc = " Returns true if all values in the range [min, max) are present."]
1130    pub fn roaring64_bitmap_contains_range(
1131        r: *const roaring64_bitmap_t,
1132        min: u64,
1133        max: u64,
1134    ) -> bool;
1135}
1136extern "C" {
1137    #[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."]
1138    pub fn roaring64_bitmap_contains_bulk(
1139        r: *const roaring64_bitmap_t,
1140        context: *mut roaring64_bulk_context_t,
1141        val: u64,
1142    ) -> bool;
1143}
1144extern "C" {
1145    #[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."]
1146    pub fn roaring64_bitmap_select(
1147        r: *const roaring64_bitmap_t,
1148        rank: u64,
1149        element: *mut u64,
1150    ) -> bool;
1151}
1152extern "C" {
1153    #[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."]
1154    pub fn roaring64_bitmap_rank(r: *const roaring64_bitmap_t, val: u64) -> u64;
1155}
1156extern "C" {
1157    #[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."]
1158    pub fn roaring64_bitmap_get_index(
1159        r: *const roaring64_bitmap_t,
1160        val: u64,
1161        out_index: *mut u64,
1162    ) -> bool;
1163}
1164extern "C" {
1165    #[doc = " Returns the number of values in the bitmap."]
1166    pub fn roaring64_bitmap_get_cardinality(r: *const roaring64_bitmap_t) -> u64;
1167}
1168extern "C" {
1169    #[doc = " Returns the number of elements in the range [min, max)."]
1170    pub fn roaring64_bitmap_range_cardinality(
1171        r: *const roaring64_bitmap_t,
1172        min: u64,
1173        max: u64,
1174    ) -> u64;
1175}
1176extern "C" {
1177    #[doc = " Returns the number of elements in the range [min, max]"]
1178    pub fn roaring64_bitmap_range_closed_cardinality(
1179        r: *const roaring64_bitmap_t,
1180        min: u64,
1181        max: u64,
1182    ) -> u64;
1183}
1184extern "C" {
1185    #[doc = " Returns true if the bitmap is empty (cardinality is zero)."]
1186    pub fn roaring64_bitmap_is_empty(r: *const roaring64_bitmap_t) -> bool;
1187}
1188extern "C" {
1189    #[doc = " Returns the smallest value in the set, or UINT64_MAX if the set is empty."]
1190    pub fn roaring64_bitmap_minimum(r: *const roaring64_bitmap_t) -> u64;
1191}
1192extern "C" {
1193    #[doc = " Returns the largest value in the set, or 0 if empty."]
1194    pub fn roaring64_bitmap_maximum(r: *const roaring64_bitmap_t) -> u64;
1195}
1196extern "C" {
1197    #[doc = " Remove run-length encoding even when it is more space efficient.\n Return whether a change was applied."]
1198    pub fn roaring64_bitmap_remove_run_compression(r: *mut roaring64_bitmap_t) -> bool;
1199}
1200extern "C" {
1201    #[doc = " Returns true if the result has at least one run container."]
1202    pub fn roaring64_bitmap_run_optimize(r: *mut roaring64_bitmap_t) -> bool;
1203}
1204extern "C" {
1205    #[doc = " Shrinks internal arrays to eliminate any unused capacity. Returns the number\n of bytes freed."]
1206    pub fn roaring64_bitmap_shrink_to_fit(r: *mut roaring64_bitmap_t) -> usize;
1207}
1208extern "C" {
1209    #[doc = "  (For advanced users.)\n Collect statistics about the bitmap"]
1210    pub fn roaring64_bitmap_statistics(
1211        r: *const roaring64_bitmap_t,
1212        stat: *mut roaring64_statistics_t,
1213    );
1214}
1215extern "C" {
1216    #[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."]
1217    pub fn roaring64_bitmap_internal_validate(
1218        r: *const roaring64_bitmap_t,
1219        reason: *mut *const ::core::ffi::c_char,
1220    ) -> bool;
1221}
1222extern "C" {
1223    #[doc = " Return true if the two bitmaps contain the same elements."]
1224    pub fn roaring64_bitmap_equals(
1225        r1: *const roaring64_bitmap_t,
1226        r2: *const roaring64_bitmap_t,
1227    ) -> bool;
1228}
1229extern "C" {
1230    #[doc = " Return true if all the elements of r1 are also in r2."]
1231    pub fn roaring64_bitmap_is_subset(
1232        r1: *const roaring64_bitmap_t,
1233        r2: *const roaring64_bitmap_t,
1234    ) -> bool;
1235}
1236extern "C" {
1237    #[doc = " Return true if all the elements of r1 are also in r2, and r2 is strictly\n greater than r1."]
1238    pub fn roaring64_bitmap_is_strict_subset(
1239        r1: *const roaring64_bitmap_t,
1240        r2: *const roaring64_bitmap_t,
1241    ) -> bool;
1242}
1243extern "C" {
1244    #[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."]
1245    pub fn roaring64_bitmap_and(
1246        r1: *const roaring64_bitmap_t,
1247        r2: *const roaring64_bitmap_t,
1248    ) -> *mut roaring64_bitmap_t;
1249}
1250extern "C" {
1251    #[doc = " Computes the size of the intersection between two bitmaps."]
1252    pub fn roaring64_bitmap_and_cardinality(
1253        r1: *const roaring64_bitmap_t,
1254        r2: *const roaring64_bitmap_t,
1255    ) -> u64;
1256}
1257extern "C" {
1258    #[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."]
1259    pub fn roaring64_bitmap_and_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1260}
1261extern "C" {
1262    #[doc = " Check whether two bitmaps intersect."]
1263    pub fn roaring64_bitmap_intersect(
1264        r1: *const roaring64_bitmap_t,
1265        r2: *const roaring64_bitmap_t,
1266    ) -> bool;
1267}
1268extern "C" {
1269    #[doc = " Check whether a bitmap intersects the range [min, max)."]
1270    pub fn roaring64_bitmap_intersect_with_range(
1271        r: *const roaring64_bitmap_t,
1272        min: u64,
1273        max: u64,
1274    ) -> bool;
1275}
1276extern "C" {
1277    #[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."]
1278    pub fn roaring64_bitmap_jaccard_index(
1279        r1: *const roaring64_bitmap_t,
1280        r2: *const roaring64_bitmap_t,
1281    ) -> f64;
1282}
1283extern "C" {
1284    #[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."]
1285    pub fn roaring64_bitmap_or(
1286        r1: *const roaring64_bitmap_t,
1287        r2: *const roaring64_bitmap_t,
1288    ) -> *mut roaring64_bitmap_t;
1289}
1290extern "C" {
1291    #[doc = " Computes the size of the union between two bitmaps."]
1292    pub fn roaring64_bitmap_or_cardinality(
1293        r1: *const roaring64_bitmap_t,
1294        r2: *const roaring64_bitmap_t,
1295    ) -> u64;
1296}
1297extern "C" {
1298    #[doc = " In-place version of `roaring64_bitmap_or(), modifies `r1`."]
1299    pub fn roaring64_bitmap_or_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1300}
1301extern "C" {
1302    #[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."]
1303    pub fn roaring64_bitmap_xor(
1304        r1: *const roaring64_bitmap_t,
1305        r2: *const roaring64_bitmap_t,
1306    ) -> *mut roaring64_bitmap_t;
1307}
1308extern "C" {
1309    #[doc = " Computes the size of the symmetric difference (xor) between two bitmaps."]
1310    pub fn roaring64_bitmap_xor_cardinality(
1311        r1: *const roaring64_bitmap_t,
1312        r2: *const roaring64_bitmap_t,
1313    ) -> u64;
1314}
1315extern "C" {
1316    #[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)."]
1317    pub fn roaring64_bitmap_xor_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1318}
1319extern "C" {
1320    #[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."]
1321    pub fn roaring64_bitmap_andnot(
1322        r1: *const roaring64_bitmap_t,
1323        r2: *const roaring64_bitmap_t,
1324    ) -> *mut roaring64_bitmap_t;
1325}
1326extern "C" {
1327    #[doc = " Computes the size of the difference (andnot) between two bitmaps."]
1328    pub fn roaring64_bitmap_andnot_cardinality(
1329        r1: *const roaring64_bitmap_t,
1330        r2: *const roaring64_bitmap_t,
1331    ) -> u64;
1332}
1333extern "C" {
1334    #[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)."]
1335    pub fn roaring64_bitmap_andnot_inplace(
1336        r1: *mut roaring64_bitmap_t,
1337        r2: *const roaring64_bitmap_t,
1338    );
1339}
1340extern "C" {
1341    #[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."]
1342    pub fn roaring64_bitmap_flip(
1343        r: *const roaring64_bitmap_t,
1344        min: u64,
1345        max: u64,
1346    ) -> *mut roaring64_bitmap_t;
1347}
1348extern "C" {
1349    #[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."]
1350    pub fn roaring64_bitmap_flip_closed(
1351        r: *const roaring64_bitmap_t,
1352        min: u64,
1353        max: u64,
1354    ) -> *mut roaring64_bitmap_t;
1355}
1356extern "C" {
1357    #[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."]
1358    pub fn roaring64_bitmap_flip_inplace(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1359}
1360extern "C" {
1361    #[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."]
1362    pub fn roaring64_bitmap_flip_closed_inplace(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1363}
1364extern "C" {
1365    #[doc = " Return a copy of the bitmap with all values shifted by offset.\n\n If `positive` is true, the shift is added, otherwise subtracted. Values that\n overflow or underflow uint64_t are dropped. The caller is responsible for\n freeing the returned bitmap."]
1366    pub fn roaring64_bitmap_add_offset_signed(
1367        r: *const roaring64_bitmap_t,
1368        positive: bool,
1369        offset: u64,
1370    ) -> *mut roaring64_bitmap_t;
1371}
1372extern "C" {
1373    #[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"]
1374    pub fn roaring64_bitmap_portable_size_in_bytes(r: *const roaring64_bitmap_t) -> usize;
1375}
1376extern "C" {
1377    #[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."]
1378    pub fn roaring64_bitmap_portable_serialize(
1379        r: *const roaring64_bitmap_t,
1380        buf: *mut ::core::ffi::c_char,
1381    ) -> usize;
1382}
1383extern "C" {
1384    #[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"]
1385    pub fn roaring64_bitmap_portable_deserialize_size(
1386        buf: *const ::core::ffi::c_char,
1387        maxbytes: usize,
1388    ) -> usize;
1389}
1390extern "C" {
1391    #[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."]
1392    pub fn roaring64_bitmap_portable_deserialize_safe(
1393        buf: *const ::core::ffi::c_char,
1394        maxbytes: usize,
1395    ) -> *mut roaring64_bitmap_t;
1396}
1397extern "C" {
1398    #[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."]
1399    pub fn roaring64_bitmap_frozen_size_in_bytes(r: *const roaring64_bitmap_t) -> usize;
1400}
1401extern "C" {
1402    #[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."]
1403    pub fn roaring64_bitmap_frozen_serialize(
1404        r: *const roaring64_bitmap_t,
1405        buf: *mut ::core::ffi::c_char,
1406    ) -> usize;
1407}
1408extern "C" {
1409    #[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."]
1410    pub fn roaring64_bitmap_frozen_view(
1411        buf: *const ::core::ffi::c_char,
1412        maxbytes: usize,
1413    ) -> *mut roaring64_bitmap_t;
1414}
1415extern "C" {
1416    #[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."]
1417    pub fn roaring64_bitmap_iterate(
1418        r: *const roaring64_bitmap_t,
1419        iterator: roaring_iterator64,
1420        ptr: *mut ::core::ffi::c_void,
1421    ) -> bool;
1422}
1423extern "C" {
1424    #[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 ```"]
1425    pub fn roaring64_bitmap_to_uint64_array(r: *const roaring64_bitmap_t, out: *mut u64);
1426}
1427extern "C" {
1428    #[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()`."]
1429    pub fn roaring64_iterator_create(r: *const roaring64_bitmap_t) -> *mut roaring64_iterator_t;
1430}
1431extern "C" {
1432    #[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()`."]
1433    pub fn roaring64_iterator_create_last(
1434        r: *const roaring64_bitmap_t,
1435    ) -> *mut roaring64_iterator_t;
1436}
1437extern "C" {
1438    #[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create` without a allocation."]
1439    pub fn roaring64_iterator_reinit(r: *const roaring64_bitmap_t, it: *mut roaring64_iterator_t);
1440}
1441extern "C" {
1442    #[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create_last` without a allocation."]
1443    pub fn roaring64_iterator_reinit_last(
1444        r: *const roaring64_bitmap_t,
1445        it: *mut roaring64_iterator_t,
1446    );
1447}
1448extern "C" {
1449    #[doc = " Creates a copy of the iterator. Caller is responsible for calling\n `roaring64_iterator_free()` on the resulting iterator."]
1450    pub fn roaring64_iterator_copy(it: *const roaring64_iterator_t) -> *mut roaring64_iterator_t;
1451}
1452extern "C" {
1453    #[doc = " Free the iterator."]
1454    pub fn roaring64_iterator_free(it: *mut roaring64_iterator_t);
1455}
1456extern "C" {
1457    #[doc = " Returns true if the iterator currently points to a value. If so, calling\n `roaring64_iterator_value()` returns the value."]
1458    pub fn roaring64_iterator_has_value(it: *const roaring64_iterator_t) -> bool;
1459}
1460extern "C" {
1461    #[doc = " Returns the value the iterator currently points to. Should only be called if\n `roaring64_iterator_has_value()` returns true."]
1462    pub fn roaring64_iterator_value(it: *const roaring64_iterator_t) -> u64;
1463}
1464extern "C" {
1465    #[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."]
1466    pub fn roaring64_iterator_advance(it: *mut roaring64_iterator_t) -> bool;
1467}
1468extern "C" {
1469    #[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."]
1470    pub fn roaring64_iterator_previous(it: *mut roaring64_iterator_t) -> bool;
1471}
1472extern "C" {
1473    #[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()`."]
1474    pub fn roaring64_iterator_move_equalorlarger(it: *mut roaring64_iterator_t, val: u64) -> bool;
1475}
1476extern "C" {
1477    #[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."]
1478    pub fn roaring64_iterator_read(it: *mut roaring64_iterator_t, buf: *mut u64, count: u64)
1479        -> u64;
1480}
1481extern "C" {
1482    #[doc = " Reads previous ${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 Values are written in descending order: buf[0] is the highest (current)\n value, buf[ret-1] is the lowest value read.\n\n This function satisfies semantics of reverse iteration and can be used\n together with other iterator functions.\n  - first value is copied from the current iterator value\n  - after function returns, iterator is positioned at the previous element"]
1483    pub fn roaring64_iterator_read_backward(
1484        it: *mut roaring64_iterator_t,
1485        buf: *mut u64,
1486        count: u64,
1487    ) -> u64;
1488}
1489#[repr(C)]
1490#[derive(Debug, Copy, Clone)]
1491pub struct roaring64_range_closed_s {
1492    pub min: u64,
1493    pub max: u64,
1494}
1495pub type roaring64_range_closed_t = roaring64_range_closed_s;
1496extern "C" {
1497    #[doc = " Reads next ${count} ranges from iterator into user-supplied ${buf}.\n A range is defined as a maximal interval of consecutive values.\n For example, the set {1,2,3,5,6} contains two ranges: [1..3] and [5..6].\n Each range is represented as a struct {min,max}, both endpoints included.\n Consecutive values that span internal container boundaries are merged into\n a single range.\n\n Returns the number of read ranges.\n This number can be smaller than ${count}, which means that the iterator is\n drained.\n\n This function can be used together with other iterator functions.\n  - first range will start with the current iterator value\n  - after the function returns, the iterator is positioned at the next element\n    after the end of the last returned range, or has_value is false if\n    the bitmap is exhausted."]
1498    pub fn roaring64_iterator_read_ranges(
1499        it: *mut roaring64_iterator_t,
1500        buf: *mut roaring64_range_closed_t,
1501        count: usize,
1502    ) -> usize;
1503}
1504extern "C" {
1505    #[doc = " Reads previous ${count} ranges from iterator into user-supplied ${buf}.\n A range is defined as a maximal interval of consecutive values.\n For example, the set {1,2,3,5,6} contains two ranges: [1..3] and [5..6].\n Each range is represented as a struct {min,max}, both endpoints included.\n Consecutive values that span internal container boundaries are merged into\n a single range.\n\n Returns the number of read ranges.\n This number can be smaller than ${count}, which means that the iterator is\n drained.\n\n Ranges are returned in reverse order, e.g. the first range returned is the\n highest range (ending at the current value).\n\n This function can be used together with other iterator functions.\n  - first range will end with the current iterator value\n  - after the function returns, the iterator is positioned at the element\n    before the beginning of the last returned range, or has_value is false if\n    the bitmap is exhausted."]
1506    pub fn roaring64_iterator_read_prev_ranges(
1507        it: *mut roaring64_iterator_t,
1508        buf: *mut roaring64_range_closed_t,
1509        count: usize,
1510    ) -> usize;
1511}