1pub const ROARING_VERSION: &[u8; 6] = b"4.3.5\0";
4pub const ROARING_VERSION_MAJOR: _bindgen_ty_1 = 4;
5pub const ROARING_VERSION_MINOR: _bindgen_ty_1 = 3;
6pub const ROARING_VERSION_REVISION: _bindgen_ty_1 = 5;
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}
212#[repr(C)]
213#[derive(Debug, Copy, Clone)]
214pub struct roaring_bitmap_s {
215 pub high_low_container: roaring_array_t,
216}
217pub type roaring_bitmap_t = roaring_bitmap_s;
218extern "C" {
219 #[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()`."]
220 pub fn roaring_bitmap_create_with_capacity(cap: u32) -> *mut roaring_bitmap_t;
221}
222extern "C" {
223 #[doc = " Dynamically allocates a new bitmap (initially empty).\n Returns NULL if the allocation fails.\n Client is responsible for calling `roaring_bitmap_free()`."]
224 pub fn roaring_bitmap_create() -> *mut roaring_bitmap_t;
225}
226extern "C" {
227 #[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."]
228 pub fn roaring_bitmap_init_with_capacity(r: *mut roaring_bitmap_t, cap: u32) -> bool;
229}
230extern "C" {
231 #[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."]
232 pub fn roaring_bitmap_init_cleared(r: *mut roaring_bitmap_t);
233}
234extern "C" {
235 #[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."]
236 pub fn roaring_bitmap_from_range(min: u64, max: u64, step: u32) -> *mut roaring_bitmap_t;
237}
238extern "C" {
239 #[doc = " Creates a new bitmap from a pointer of uint32_t integers\n The returned pointer may be NULL in case of errors."]
240 pub fn roaring_bitmap_of_ptr(n_args: usize, vals: *const u32) -> *mut roaring_bitmap_t;
241}
242extern "C" {
243 pub fn roaring_bitmap_get_copy_on_write(r: *const roaring_bitmap_t) -> bool;
244}
245extern "C" {
246 pub fn roaring_bitmap_set_copy_on_write(r: *mut roaring_bitmap_t, cow: bool);
247}
248extern "C" {
249 #[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."]
250 pub fn roaring_bitmap_add_offset(
251 bm: *const roaring_bitmap_t,
252 offset: i64,
253 ) -> *mut roaring_bitmap_t;
254}
255extern "C" {
256 #[doc = " Describe the inner structure of the bitmap."]
257 pub fn roaring_bitmap_printf_describe(r: *const roaring_bitmap_t);
258}
259extern "C" {
260 #[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"]
261 pub fn roaring_bitmap_of(n: usize, ...) -> *mut roaring_bitmap_t;
262}
263extern "C" {
264 #[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."]
265 pub fn roaring_bitmap_copy(r: *const roaring_bitmap_t) -> *mut roaring_bitmap_t;
266}
267extern "C" {
268 #[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)."]
269 pub fn roaring_bitmap_overwrite(
270 dest: *mut roaring_bitmap_t,
271 src: *const roaring_bitmap_t,
272 ) -> bool;
273}
274extern "C" {
275 #[doc = " Print the content of the bitmap."]
276 pub fn roaring_bitmap_printf(r: *const roaring_bitmap_t);
277}
278extern "C" {
279 #[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."]
280 pub fn roaring_bitmap_and(
281 r1: *const roaring_bitmap_t,
282 r2: *const roaring_bitmap_t,
283 ) -> *mut roaring_bitmap_t;
284}
285extern "C" {
286 #[doc = " Computes the size of the intersection between two bitmaps."]
287 pub fn roaring_bitmap_and_cardinality(
288 r1: *const roaring_bitmap_t,
289 r2: *const roaring_bitmap_t,
290 ) -> u64;
291}
292extern "C" {
293 #[doc = " Check whether two bitmaps intersect."]
294 pub fn roaring_bitmap_intersect(
295 r1: *const roaring_bitmap_t,
296 r2: *const roaring_bitmap_t,
297 ) -> bool;
298}
299extern "C" {
300 #[doc = " Check whether a bitmap and an open range intersect."]
301 pub fn roaring_bitmap_intersect_with_range(bm: *const roaring_bitmap_t, x: u64, y: u64)
302 -> bool;
303}
304extern "C" {
305 #[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."]
306 pub fn roaring_bitmap_jaccard_index(
307 r1: *const roaring_bitmap_t,
308 r2: *const roaring_bitmap_t,
309 ) -> f64;
310}
311extern "C" {
312 #[doc = " Computes the size of the union between two bitmaps."]
313 pub fn roaring_bitmap_or_cardinality(
314 r1: *const roaring_bitmap_t,
315 r2: *const roaring_bitmap_t,
316 ) -> u64;
317}
318extern "C" {
319 #[doc = " Computes the size of the difference (andnot) between two bitmaps."]
320 pub fn roaring_bitmap_andnot_cardinality(
321 r1: *const roaring_bitmap_t,
322 r2: *const roaring_bitmap_t,
323 ) -> u64;
324}
325extern "C" {
326 #[doc = " Computes the size of the symmetric difference (xor) between two bitmaps."]
327 pub fn roaring_bitmap_xor_cardinality(
328 r1: *const roaring_bitmap_t,
329 r2: *const roaring_bitmap_t,
330 ) -> u64;
331}
332extern "C" {
333 #[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."]
334 pub fn roaring_bitmap_and_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
335}
336extern "C" {
337 #[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."]
338 pub fn roaring_bitmap_or(
339 r1: *const roaring_bitmap_t,
340 r2: *const roaring_bitmap_t,
341 ) -> *mut roaring_bitmap_t;
342}
343extern "C" {
344 #[doc = " Inplace version of `roaring_bitmap_or(), modifies r1.\n TODO: decide whether r1 == r2 ok"]
345 pub fn roaring_bitmap_or_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
346}
347extern "C" {
348 #[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."]
349 pub fn roaring_bitmap_or_many(
350 number: usize,
351 rs: *mut *const roaring_bitmap_t,
352 ) -> *mut roaring_bitmap_t;
353}
354extern "C" {
355 #[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."]
356 pub fn roaring_bitmap_or_many_heap(
357 number: u32,
358 rs: *mut *const roaring_bitmap_t,
359 ) -> *mut roaring_bitmap_t;
360}
361extern "C" {
362 #[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."]
363 pub fn roaring_bitmap_xor(
364 r1: *const roaring_bitmap_t,
365 r2: *const roaring_bitmap_t,
366 ) -> *mut roaring_bitmap_t;
367}
368extern "C" {
369 #[doc = " Inplace version of roaring_bitmap_xor, modifies r1, r1 != r2."]
370 pub fn roaring_bitmap_xor_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
371}
372extern "C" {
373 #[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."]
374 pub fn roaring_bitmap_xor_many(
375 number: usize,
376 rs: *mut *const roaring_bitmap_t,
377 ) -> *mut roaring_bitmap_t;
378}
379extern "C" {
380 #[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."]
381 pub fn roaring_bitmap_andnot(
382 r1: *const roaring_bitmap_t,
383 r2: *const roaring_bitmap_t,
384 ) -> *mut roaring_bitmap_t;
385}
386extern "C" {
387 #[doc = " Inplace version of roaring_bitmap_andnot, modifies r1, r1 != r2."]
388 pub fn roaring_bitmap_andnot_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
389}
390extern "C" {
391 #[doc = " Frees the memory."]
392 pub fn roaring_bitmap_free(r: *const roaring_bitmap_t);
393}
394#[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."]
395#[repr(C)]
396#[derive(Debug, Copy, Clone)]
397pub struct roaring_bulk_context_s {
398 pub container: *mut ::core::ffi::c_void,
399 pub idx: ::core::ffi::c_int,
400 pub key: u16,
401 pub typecode: u8,
402}
403#[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."]
404pub type roaring_bulk_context_t = roaring_bulk_context_s;
405extern "C" {
406 #[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."]
407 pub fn roaring_bitmap_add_bulk(
408 r: *mut roaring_bitmap_t,
409 context: *mut roaring_bulk_context_t,
410 val: u32,
411 );
412}
413extern "C" {
414 #[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`"]
415 pub fn roaring_bitmap_add_many(r: *mut roaring_bitmap_t, n_args: usize, vals: *const u32);
416}
417extern "C" {
418 #[doc = " Add value x"]
419 pub fn roaring_bitmap_add(r: *mut roaring_bitmap_t, x: u32);
420}
421extern "C" {
422 #[doc = " Add value x\n Returns true if a new value was added, false if the value already existed."]
423 pub fn roaring_bitmap_add_checked(r: *mut roaring_bitmap_t, x: u32) -> bool;
424}
425extern "C" {
426 #[doc = " Add all values in range [min, max]"]
427 pub fn roaring_bitmap_add_range_closed(r: *mut roaring_bitmap_t, min: u32, max: u32);
428}
429extern "C" {
430 #[doc = " Add all values in range [min, max)"]
431 pub fn roaring_bitmap_add_range(r: *mut roaring_bitmap_t, min: u64, max: u64);
432}
433extern "C" {
434 #[doc = " Remove value x"]
435 pub fn roaring_bitmap_remove(r: *mut roaring_bitmap_t, x: u32);
436}
437extern "C" {
438 #[doc = " Remove all values in range [min, max]"]
439 pub fn roaring_bitmap_remove_range_closed(r: *mut roaring_bitmap_t, min: u32, max: u32);
440}
441extern "C" {
442 #[doc = " Remove all values in range [min, max)"]
443 pub fn roaring_bitmap_remove_range(r: *mut roaring_bitmap_t, min: u64, max: u64);
444}
445extern "C" {
446 #[doc = " Remove multiple values"]
447 pub fn roaring_bitmap_remove_many(r: *mut roaring_bitmap_t, n_args: usize, vals: *const u32);
448}
449extern "C" {
450 #[doc = " Remove value x\n Returns true if a new value was removed, false if the value was not existing."]
451 pub fn roaring_bitmap_remove_checked(r: *mut roaring_bitmap_t, x: u32) -> bool;
452}
453extern "C" {
454 #[doc = " Check if value is present"]
455 pub fn roaring_bitmap_contains(r: *const roaring_bitmap_t, val: u32) -> bool;
456}
457extern "C" {
458 #[doc = " Check whether a range of values from range_start (included)\n to range_end (excluded) is present"]
459 pub fn roaring_bitmap_contains_range(
460 r: *const roaring_bitmap_t,
461 range_start: u64,
462 range_end: u64,
463 ) -> bool;
464}
465extern "C" {
466 #[doc = " Check whether a range of values from range_start (included)\n to range_end (included) is present"]
467 pub fn roaring_bitmap_contains_range_closed(
468 r: *const roaring_bitmap_t,
469 range_start: u32,
470 range_end: u32,
471 ) -> bool;
472}
473extern "C" {
474 #[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."]
475 pub fn roaring_bitmap_contains_bulk(
476 r: *const roaring_bitmap_t,
477 context: *mut roaring_bulk_context_t,
478 val: u32,
479 ) -> bool;
480}
481extern "C" {
482 #[doc = " Get the cardinality of the bitmap (number of elements)."]
483 pub fn roaring_bitmap_get_cardinality(r: *const roaring_bitmap_t) -> u64;
484}
485extern "C" {
486 #[doc = " Returns the number of elements in the range [range_start, range_end)."]
487 pub fn roaring_bitmap_range_cardinality(
488 r: *const roaring_bitmap_t,
489 range_start: u64,
490 range_end: u64,
491 ) -> u64;
492}
493extern "C" {
494 #[doc = " Returns the number of elements in the range [range_start, range_end]."]
495 pub fn roaring_bitmap_range_cardinality_closed(
496 r: *const roaring_bitmap_t,
497 range_start: u32,
498 range_end: u32,
499 ) -> u64;
500}
501extern "C" {
502 #[doc = " Returns true if the bitmap is empty (cardinality is zero)."]
503 pub fn roaring_bitmap_is_empty(r: *const roaring_bitmap_t) -> bool;
504}
505extern "C" {
506 #[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)"]
507 pub fn roaring_bitmap_clear(r: *mut roaring_bitmap_t);
508}
509extern "C" {
510 #[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));"]
511 pub fn roaring_bitmap_to_uint32_array(r: *const roaring_bitmap_t, ans: *mut u32);
512}
513extern "C" {
514 #[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"]
515 pub fn roaring_bitmap_to_bitset(r: *const roaring_bitmap_t, bitset: *mut bitset_t) -> bool;
516}
517extern "C" {
518 #[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 Return false in case of failure (e.g., insufficient memory)"]
519 pub fn roaring_bitmap_range_uint32_array(
520 r: *const roaring_bitmap_t,
521 offset: usize,
522 limit: usize,
523 ans: *mut u32,
524 ) -> bool;
525}
526extern "C" {
527 #[doc = " Remove run-length encoding even when it is more space efficient.\n Return whether a change was applied."]
528 pub fn roaring_bitmap_remove_run_compression(r: *mut roaring_bitmap_t) -> bool;
529}
530extern "C" {
531 #[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()`."]
532 pub fn roaring_bitmap_run_optimize(r: *mut roaring_bitmap_t) -> bool;
533}
534extern "C" {
535 #[doc = " If needed, reallocate memory to shrink the memory usage.\n Returns the number of bytes saved."]
536 pub fn roaring_bitmap_shrink_to_fit(r: *mut roaring_bitmap_t) -> usize;
537}
538extern "C" {
539 #[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."]
540 pub fn roaring_bitmap_serialize(
541 r: *const roaring_bitmap_t,
542 buf: *mut ::core::ffi::c_char,
543 ) -> usize;
544}
545extern "C" {
546 #[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."]
547 pub fn roaring_bitmap_deserialize(buf: *const ::core::ffi::c_void) -> *mut roaring_bitmap_t;
548}
549extern "C" {
550 #[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."]
551 pub fn roaring_bitmap_deserialize_safe(
552 buf: *const ::core::ffi::c_void,
553 maxbytes: usize,
554 ) -> *mut roaring_bitmap_t;
555}
556extern "C" {
557 #[doc = " How many bytes are required to serialize this bitmap (NOT compatible\n with Java and Go versions)"]
558 pub fn roaring_bitmap_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
559}
560extern "C" {
561 #[doc = " Read bitmap from a serialized buffer.\n In case of failure, NULL is returned.\n\n This function is unsafe in the sense that if there is no valid serialized\n bitmap at the pointer, then many bytes could be read, possibly causing a\n buffer overflow. See also roaring_bitmap_portable_deserialize_safe().\n\n This is meant to be compatible with the Java and Go versions:\n https://github.com/RoaringBitmap/RoaringFormatSpec\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a\n mainframe IBM s390x), the data format is going to be big-endian and not\n compatible with little-endian systems.\n\n The returned pointer may be NULL in case of errors."]
562 pub fn roaring_bitmap_portable_deserialize(
563 buf: *const ::core::ffi::c_char,
564 ) -> *mut roaring_bitmap_t;
565}
566extern "C" {
567 #[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."]
568 pub fn roaring_bitmap_portable_deserialize_safe(
569 buf: *const ::core::ffi::c_char,
570 maxbytes: usize,
571 ) -> *mut roaring_bitmap_t;
572}
573extern "C" {
574 #[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."]
575 pub fn roaring_bitmap_portable_deserialize_frozen(
576 buf: *const ::core::ffi::c_char,
577 ) -> *mut roaring_bitmap_t;
578}
579extern "C" {
580 #[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"]
581 pub fn roaring_bitmap_portable_deserialize_size(
582 buf: *const ::core::ffi::c_char,
583 maxbytes: usize,
584 ) -> usize;
585}
586extern "C" {
587 #[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"]
588 pub fn roaring_bitmap_portable_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
589}
590extern "C" {
591 #[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."]
592 pub fn roaring_bitmap_portable_serialize(
593 r: *const roaring_bitmap_t,
594 buf: *mut ::core::ffi::c_char,
595 ) -> usize;
596}
597extern "C" {
598 #[doc = " Returns number of bytes required to serialize bitmap using frozen format."]
599 pub fn roaring_bitmap_frozen_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
600}
601extern "C" {
602 #[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."]
603 pub fn roaring_bitmap_frozen_serialize(
604 r: *const roaring_bitmap_t,
605 buf: *mut ::core::ffi::c_char,
606 );
607}
608extern "C" {
609 #[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."]
610 pub fn roaring_bitmap_frozen_view(
611 buf: *const ::core::ffi::c_char,
612 length: usize,
613 ) -> *const roaring_bitmap_t;
614}
615extern "C" {
616 #[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."]
617 pub fn roaring_iterate(
618 r: *const roaring_bitmap_t,
619 iterator: roaring_iterator,
620 ptr: *mut ::core::ffi::c_void,
621 ) -> bool;
622}
623extern "C" {
624 pub fn roaring_iterate64(
625 r: *const roaring_bitmap_t,
626 iterator: roaring_iterator64,
627 high_bits: u64,
628 ptr: *mut ::core::ffi::c_void,
629 ) -> bool;
630}
631extern "C" {
632 #[doc = " Return true if the two bitmaps contain the same elements."]
633 pub fn roaring_bitmap_equals(r1: *const roaring_bitmap_t, r2: *const roaring_bitmap_t) -> bool;
634}
635extern "C" {
636 #[doc = " Return true if all the elements of r1 are also in r2."]
637 pub fn roaring_bitmap_is_subset(
638 r1: *const roaring_bitmap_t,
639 r2: *const roaring_bitmap_t,
640 ) -> bool;
641}
642extern "C" {
643 #[doc = " Return true if all the elements of r1 are also in r2, and r2 is strictly\n greater than r1."]
644 pub fn roaring_bitmap_is_strict_subset(
645 r1: *const roaring_bitmap_t,
646 r2: *const roaring_bitmap_t,
647 ) -> bool;
648}
649extern "C" {
650 #[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."]
651 pub fn roaring_bitmap_lazy_or(
652 r1: *const roaring_bitmap_t,
653 r2: *const roaring_bitmap_t,
654 bitsetconversion: bool,
655 ) -> *mut roaring_bitmap_t;
656}
657extern "C" {
658 #[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."]
659 pub fn roaring_bitmap_lazy_or_inplace(
660 r1: *mut roaring_bitmap_t,
661 r2: *const roaring_bitmap_t,
662 bitsetconversion: bool,
663 );
664}
665extern "C" {
666 #[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()`."]
667 pub fn roaring_bitmap_repair_after_lazy(r1: *mut roaring_bitmap_t);
668}
669extern "C" {
670 #[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."]
671 pub fn roaring_bitmap_lazy_xor(
672 r1: *const roaring_bitmap_t,
673 r2: *const roaring_bitmap_t,
674 ) -> *mut roaring_bitmap_t;
675}
676extern "C" {
677 #[doc = " (For expert users who seek high performance.)\n\n Inplace version of roaring_bitmap_lazy_xor, modifies r1. r1 != r2"]
678 pub fn roaring_bitmap_lazy_xor_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
679}
680extern "C" {
681 #[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."]
682 pub fn roaring_bitmap_flip(
683 r1: *const roaring_bitmap_t,
684 range_start: u64,
685 range_end: u64,
686 ) -> *mut roaring_bitmap_t;
687}
688extern "C" {
689 #[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."]
690 pub fn roaring_bitmap_flip_closed(
691 x1: *const roaring_bitmap_t,
692 range_start: u32,
693 range_end: u32,
694 ) -> *mut roaring_bitmap_t;
695}
696extern "C" {
697 #[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."]
698 pub fn roaring_bitmap_flip_inplace(r1: *mut roaring_bitmap_t, range_start: u64, range_end: u64);
699}
700extern "C" {
701 #[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."]
702 pub fn roaring_bitmap_flip_inplace_closed(
703 r1: *mut roaring_bitmap_t,
704 range_start: u32,
705 range_end: u32,
706 );
707}
708extern "C" {
709 #[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."]
710 pub fn roaring_bitmap_select(r: *const roaring_bitmap_t, rank: u32, element: *mut u32) -> bool;
711}
712extern "C" {
713 #[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."]
714 pub fn roaring_bitmap_rank(r: *const roaring_bitmap_t, x: u32) -> u64;
715}
716extern "C" {
717 #[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));"]
718 pub fn roaring_bitmap_rank_many(
719 r: *const roaring_bitmap_t,
720 begin: *const u32,
721 end: *const u32,
722 ans: *mut u64,
723 );
724}
725extern "C" {
726 #[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."]
727 pub fn roaring_bitmap_get_index(r: *const roaring_bitmap_t, x: u32) -> i64;
728}
729extern "C" {
730 #[doc = " Returns the smallest value in the set, or UINT32_MAX if the set is empty."]
731 pub fn roaring_bitmap_minimum(r: *const roaring_bitmap_t) -> u32;
732}
733extern "C" {
734 #[doc = " Returns the greatest value in the set, or 0 if the set is empty."]
735 pub fn roaring_bitmap_maximum(r: *const roaring_bitmap_t) -> u32;
736}
737extern "C" {
738 #[doc = " (For advanced users.)\n\n Collect statistics about the bitmap, see roaring_types.h for\n a description of roaring_statistics_t"]
739 pub fn roaring_bitmap_statistics(r: *const roaring_bitmap_t, stat: *mut roaring_statistics_t);
740}
741extern "C" {
742 #[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."]
743 pub fn roaring_bitmap_internal_validate(
744 r: *const roaring_bitmap_t,
745 reason: *mut *const ::core::ffi::c_char,
746 ) -> bool;
747}
748#[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."]
749#[repr(C)]
750#[derive(Debug, Copy, Clone)]
751pub struct roaring_uint32_iterator_s {
752 pub parent: *const roaring_bitmap_t,
753 pub container: *const ::core::ffi::c_void,
754 pub typecode: u8,
755 pub container_index: i32,
756 pub highbits: u32,
757 pub container_it: roaring_container_iterator_t,
758 pub current_value: u32,
759 pub has_value: bool,
760}
761#[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."]
762pub type roaring_uint32_iterator_t = roaring_uint32_iterator_s;
763extern "C" {
764 #[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`."]
765 pub fn roaring_iterator_init(r: *const roaring_bitmap_t, newit: *mut roaring_uint32_iterator_t);
766}
767extern "C" {
768 #[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`."]
769 pub fn roaring_iterator_init_last(
770 r: *const roaring_bitmap_t,
771 newit: *mut roaring_uint32_iterator_t,
772 );
773}
774extern "C" {
775 #[doc = " Create an iterator object that can be used to iterate through the values.\n Caller is responsible for calling `roaring_free_iterator()`.\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`."]
776 pub fn roaring_iterator_create(r: *const roaring_bitmap_t) -> *mut roaring_uint32_iterator_t;
777}
778extern "C" {
779 #[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."]
780 pub fn roaring_uint32_iterator_advance(it: *mut roaring_uint32_iterator_t) -> bool;
781}
782extern "C" {
783 #[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."]
784 pub fn roaring_uint32_iterator_previous(it: *mut roaring_uint32_iterator_t) -> bool;
785}
786extern "C" {
787 #[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`."]
788 pub fn roaring_uint32_iterator_move_equalorlarger(
789 it: *mut roaring_uint32_iterator_t,
790 val: u32,
791 ) -> bool;
792}
793extern "C" {
794 #[doc = " Creates a copy of an iterator.\n Caller must free it."]
795 pub fn roaring_uint32_iterator_copy(
796 it: *const roaring_uint32_iterator_t,
797 ) -> *mut roaring_uint32_iterator_t;
798}
799extern "C" {
800 #[doc = " Free memory following `roaring_iterator_create()`"]
801 pub fn roaring_uint32_iterator_free(it: *mut roaring_uint32_iterator_t);
802}
803extern "C" {
804 pub fn roaring_uint32_iterator_read(
805 it: *mut roaring_uint32_iterator_t,
806 buf: *mut u32,
807 count: u32,
808 ) -> u32;
809}
810pub type roaring_malloc_p =
811 ::core::option::Option<unsafe extern "C" fn(arg1: usize) -> *mut ::core::ffi::c_void>;
812pub type roaring_realloc_p = ::core::option::Option<
813 unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void, arg2: usize) -> *mut ::core::ffi::c_void,
814>;
815pub type roaring_calloc_p = ::core::option::Option<
816 unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
817>;
818pub type roaring_free_p =
819 ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>;
820pub type roaring_aligned_malloc_p = ::core::option::Option<
821 unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
822>;
823pub type roaring_aligned_free_p =
824 ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>;
825#[repr(C)]
826#[derive(Debug, Copy, Clone)]
827pub struct roaring_memory_s {
828 pub malloc: roaring_malloc_p,
829 pub realloc: roaring_realloc_p,
830 pub calloc: roaring_calloc_p,
831 pub free: roaring_free_p,
832 pub aligned_malloc: roaring_aligned_malloc_p,
833 pub aligned_free: roaring_aligned_free_p,
834}
835pub type roaring_memory_t = roaring_memory_s;
836extern "C" {
837 pub fn roaring_init_memory_hook(memory_hook: roaring_memory_t);
838}
839extern "C" {
840 pub fn roaring_malloc(arg1: usize) -> *mut ::core::ffi::c_void;
841}
842extern "C" {
843 pub fn roaring_realloc(arg1: *mut ::core::ffi::c_void, arg2: usize)
844 -> *mut ::core::ffi::c_void;
845}
846extern "C" {
847 pub fn roaring_calloc(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void;
848}
849extern "C" {
850 pub fn roaring_free(arg1: *mut ::core::ffi::c_void);
851}
852extern "C" {
853 pub fn roaring_aligned_malloc(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void;
854}
855extern "C" {
856 pub fn roaring_aligned_free(arg1: *mut ::core::ffi::c_void);
857}
858#[repr(C)]
859#[derive(Debug, Copy, Clone)]
860pub struct roaring64_bitmap_s {
861 _unused: [u8; 0],
862}
863pub type roaring64_bitmap_t = roaring64_bitmap_s;
864pub type roaring64_leaf_t = u64;
865#[repr(C)]
866#[derive(Debug, Copy, Clone)]
867pub struct roaring64_iterator_s {
868 _unused: [u8; 0],
869}
870pub type roaring64_iterator_t = roaring64_iterator_s;
871#[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."]
872#[repr(C)]
873#[derive(Debug, Copy, Clone)]
874pub struct roaring64_bulk_context_s {
875 pub high_bytes: [u8; 6usize],
876 pub leaf: *mut roaring64_leaf_t,
877}
878#[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."]
879pub type roaring64_bulk_context_t = roaring64_bulk_context_s;
880extern "C" {
881 #[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."]
882 pub fn roaring64_bitmap_create() -> *mut roaring64_bitmap_t;
883}
884extern "C" {
885 pub fn roaring64_bitmap_free(r: *mut roaring64_bitmap_t);
886}
887extern "C" {
888 #[doc = " Returns a copy of a bitmap.\n The returned pointer may be NULL in case of errors."]
889 pub fn roaring64_bitmap_copy(r: *const roaring64_bitmap_t) -> *mut roaring64_bitmap_t;
890}
891extern "C" {
892 #[doc = " Creates a new bitmap of a pointer to N 64-bit integers."]
893 pub fn roaring64_bitmap_of_ptr(n_args: usize, vals: *const u64) -> *mut roaring64_bitmap_t;
894}
895extern "C" {
896 #[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."]
897 pub fn roaring64_bitmap_move_from_roaring32(
898 r: *mut roaring_bitmap_t,
899 ) -> *mut roaring64_bitmap_t;
900}
901extern "C" {
902 #[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."]
903 pub fn roaring64_bitmap_from_range(min: u64, max: u64, step: u64) -> *mut roaring64_bitmap_t;
904}
905extern "C" {
906 #[doc = " Adds the provided value to the bitmap."]
907 pub fn roaring64_bitmap_add(r: *mut roaring64_bitmap_t, val: u64);
908}
909extern "C" {
910 #[doc = " Adds the provided value to the bitmap.\n Returns true if a new value was added, false if the value already existed."]
911 pub fn roaring64_bitmap_add_checked(r: *mut roaring64_bitmap_t, val: u64) -> bool;
912}
913extern "C" {
914 #[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."]
915 pub fn roaring64_bitmap_add_bulk(
916 r: *mut roaring64_bitmap_t,
917 context: *mut roaring64_bulk_context_t,
918 val: u64,
919 );
920}
921extern "C" {
922 #[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`."]
923 pub fn roaring64_bitmap_add_many(r: *mut roaring64_bitmap_t, n_args: usize, vals: *const u64);
924}
925extern "C" {
926 #[doc = " Add all values in range [min, max)."]
927 pub fn roaring64_bitmap_add_range(r: *mut roaring64_bitmap_t, min: u64, max: u64);
928}
929extern "C" {
930 #[doc = " Add all values in range [min, max]."]
931 pub fn roaring64_bitmap_add_range_closed(r: *mut roaring64_bitmap_t, min: u64, max: u64);
932}
933extern "C" {
934 #[doc = " Removes a value from the bitmap if present."]
935 pub fn roaring64_bitmap_remove(r: *mut roaring64_bitmap_t, val: u64);
936}
937extern "C" {
938 #[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."]
939 pub fn roaring64_bitmap_remove_checked(r: *mut roaring64_bitmap_t, val: u64) -> bool;
940}
941extern "C" {
942 #[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."]
943 pub fn roaring64_bitmap_remove_bulk(
944 r: *mut roaring64_bitmap_t,
945 context: *mut roaring64_bulk_context_t,
946 val: u64,
947 );
948}
949extern "C" {
950 #[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`."]
951 pub fn roaring64_bitmap_remove_many(
952 r: *mut roaring64_bitmap_t,
953 n_args: usize,
954 vals: *const u64,
955 );
956}
957extern "C" {
958 #[doc = " Remove all values in range [min, max)."]
959 pub fn roaring64_bitmap_remove_range(r: *mut roaring64_bitmap_t, min: u64, max: u64);
960}
961extern "C" {
962 #[doc = " Remove all values in range [min, max]."]
963 pub fn roaring64_bitmap_remove_range_closed(r: *mut roaring64_bitmap_t, min: u64, max: u64);
964}
965extern "C" {
966 #[doc = " Empties the bitmap."]
967 pub fn roaring64_bitmap_clear(r: *mut roaring64_bitmap_t);
968}
969extern "C" {
970 #[doc = " Returns true if the provided value is present."]
971 pub fn roaring64_bitmap_contains(r: *const roaring64_bitmap_t, val: u64) -> bool;
972}
973extern "C" {
974 #[doc = " Returns true if all values in the range [min, max) are present."]
975 pub fn roaring64_bitmap_contains_range(
976 r: *const roaring64_bitmap_t,
977 min: u64,
978 max: u64,
979 ) -> bool;
980}
981extern "C" {
982 #[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."]
983 pub fn roaring64_bitmap_contains_bulk(
984 r: *const roaring64_bitmap_t,
985 context: *mut roaring64_bulk_context_t,
986 val: u64,
987 ) -> bool;
988}
989extern "C" {
990 #[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."]
991 pub fn roaring64_bitmap_select(
992 r: *const roaring64_bitmap_t,
993 rank: u64,
994 element: *mut u64,
995 ) -> bool;
996}
997extern "C" {
998 #[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."]
999 pub fn roaring64_bitmap_rank(r: *const roaring64_bitmap_t, val: u64) -> u64;
1000}
1001extern "C" {
1002 #[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."]
1003 pub fn roaring64_bitmap_get_index(
1004 r: *const roaring64_bitmap_t,
1005 val: u64,
1006 out_index: *mut u64,
1007 ) -> bool;
1008}
1009extern "C" {
1010 #[doc = " Returns the number of values in the bitmap."]
1011 pub fn roaring64_bitmap_get_cardinality(r: *const roaring64_bitmap_t) -> u64;
1012}
1013extern "C" {
1014 #[doc = " Returns the number of elements in the range [min, max)."]
1015 pub fn roaring64_bitmap_range_cardinality(
1016 r: *const roaring64_bitmap_t,
1017 min: u64,
1018 max: u64,
1019 ) -> u64;
1020}
1021extern "C" {
1022 #[doc = " Returns the number of elements in the range [min, max]"]
1023 pub fn roaring64_bitmap_range_closed_cardinality(
1024 r: *const roaring64_bitmap_t,
1025 min: u64,
1026 max: u64,
1027 ) -> u64;
1028}
1029extern "C" {
1030 #[doc = " Returns true if the bitmap is empty (cardinality is zero)."]
1031 pub fn roaring64_bitmap_is_empty(r: *const roaring64_bitmap_t) -> bool;
1032}
1033extern "C" {
1034 #[doc = " Returns the smallest value in the set, or UINT64_MAX if the set is empty."]
1035 pub fn roaring64_bitmap_minimum(r: *const roaring64_bitmap_t) -> u64;
1036}
1037extern "C" {
1038 #[doc = " Returns the largest value in the set, or 0 if empty."]
1039 pub fn roaring64_bitmap_maximum(r: *const roaring64_bitmap_t) -> u64;
1040}
1041extern "C" {
1042 #[doc = " Returns true if the result has at least one run container."]
1043 pub fn roaring64_bitmap_run_optimize(r: *mut roaring64_bitmap_t) -> bool;
1044}
1045extern "C" {
1046 #[doc = " Shrinks internal arrays to eliminate any unused capacity. Returns the number\n of bytes freed."]
1047 pub fn roaring64_bitmap_shrink_to_fit(r: *mut roaring64_bitmap_t) -> usize;
1048}
1049extern "C" {
1050 #[doc = " (For advanced users.)\n Collect statistics about the bitmap"]
1051 pub fn roaring64_bitmap_statistics(
1052 r: *const roaring64_bitmap_t,
1053 stat: *mut roaring64_statistics_t,
1054 );
1055}
1056extern "C" {
1057 #[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."]
1058 pub fn roaring64_bitmap_internal_validate(
1059 r: *const roaring64_bitmap_t,
1060 reason: *mut *const ::core::ffi::c_char,
1061 ) -> bool;
1062}
1063extern "C" {
1064 #[doc = " Return true if the two bitmaps contain the same elements."]
1065 pub fn roaring64_bitmap_equals(
1066 r1: *const roaring64_bitmap_t,
1067 r2: *const roaring64_bitmap_t,
1068 ) -> bool;
1069}
1070extern "C" {
1071 #[doc = " Return true if all the elements of r1 are also in r2."]
1072 pub fn roaring64_bitmap_is_subset(
1073 r1: *const roaring64_bitmap_t,
1074 r2: *const roaring64_bitmap_t,
1075 ) -> bool;
1076}
1077extern "C" {
1078 #[doc = " Return true if all the elements of r1 are also in r2, and r2 is strictly\n greater than r1."]
1079 pub fn roaring64_bitmap_is_strict_subset(
1080 r1: *const roaring64_bitmap_t,
1081 r2: *const roaring64_bitmap_t,
1082 ) -> bool;
1083}
1084extern "C" {
1085 #[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."]
1086 pub fn roaring64_bitmap_and(
1087 r1: *const roaring64_bitmap_t,
1088 r2: *const roaring64_bitmap_t,
1089 ) -> *mut roaring64_bitmap_t;
1090}
1091extern "C" {
1092 #[doc = " Computes the size of the intersection between two bitmaps."]
1093 pub fn roaring64_bitmap_and_cardinality(
1094 r1: *const roaring64_bitmap_t,
1095 r2: *const roaring64_bitmap_t,
1096 ) -> u64;
1097}
1098extern "C" {
1099 #[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."]
1100 pub fn roaring64_bitmap_and_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1101}
1102extern "C" {
1103 #[doc = " Check whether two bitmaps intersect."]
1104 pub fn roaring64_bitmap_intersect(
1105 r1: *const roaring64_bitmap_t,
1106 r2: *const roaring64_bitmap_t,
1107 ) -> bool;
1108}
1109extern "C" {
1110 #[doc = " Check whether a bitmap intersects the range [min, max)."]
1111 pub fn roaring64_bitmap_intersect_with_range(
1112 r: *const roaring64_bitmap_t,
1113 min: u64,
1114 max: u64,
1115 ) -> bool;
1116}
1117extern "C" {
1118 #[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."]
1119 pub fn roaring64_bitmap_jaccard_index(
1120 r1: *const roaring64_bitmap_t,
1121 r2: *const roaring64_bitmap_t,
1122 ) -> f64;
1123}
1124extern "C" {
1125 #[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."]
1126 pub fn roaring64_bitmap_or(
1127 r1: *const roaring64_bitmap_t,
1128 r2: *const roaring64_bitmap_t,
1129 ) -> *mut roaring64_bitmap_t;
1130}
1131extern "C" {
1132 #[doc = " Computes the size of the union between two bitmaps."]
1133 pub fn roaring64_bitmap_or_cardinality(
1134 r1: *const roaring64_bitmap_t,
1135 r2: *const roaring64_bitmap_t,
1136 ) -> u64;
1137}
1138extern "C" {
1139 #[doc = " In-place version of `roaring64_bitmap_or(), modifies `r1`."]
1140 pub fn roaring64_bitmap_or_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1141}
1142extern "C" {
1143 #[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."]
1144 pub fn roaring64_bitmap_xor(
1145 r1: *const roaring64_bitmap_t,
1146 r2: *const roaring64_bitmap_t,
1147 ) -> *mut roaring64_bitmap_t;
1148}
1149extern "C" {
1150 #[doc = " Computes the size of the symmetric difference (xor) between two bitmaps."]
1151 pub fn roaring64_bitmap_xor_cardinality(
1152 r1: *const roaring64_bitmap_t,
1153 r2: *const roaring64_bitmap_t,
1154 ) -> u64;
1155}
1156extern "C" {
1157 #[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)."]
1158 pub fn roaring64_bitmap_xor_inplace(r1: *mut roaring64_bitmap_t, r2: *const roaring64_bitmap_t);
1159}
1160extern "C" {
1161 #[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."]
1162 pub fn roaring64_bitmap_andnot(
1163 r1: *const roaring64_bitmap_t,
1164 r2: *const roaring64_bitmap_t,
1165 ) -> *mut roaring64_bitmap_t;
1166}
1167extern "C" {
1168 #[doc = " Computes the size of the difference (andnot) between two bitmaps."]
1169 pub fn roaring64_bitmap_andnot_cardinality(
1170 r1: *const roaring64_bitmap_t,
1171 r2: *const roaring64_bitmap_t,
1172 ) -> u64;
1173}
1174extern "C" {
1175 #[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)."]
1176 pub fn roaring64_bitmap_andnot_inplace(
1177 r1: *mut roaring64_bitmap_t,
1178 r2: *const roaring64_bitmap_t,
1179 );
1180}
1181extern "C" {
1182 #[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."]
1183 pub fn roaring64_bitmap_flip(
1184 r: *const roaring64_bitmap_t,
1185 min: u64,
1186 max: u64,
1187 ) -> *mut roaring64_bitmap_t;
1188}
1189extern "C" {
1190 #[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."]
1191 pub fn roaring64_bitmap_flip_closed(
1192 r: *const roaring64_bitmap_t,
1193 min: u64,
1194 max: u64,
1195 ) -> *mut roaring64_bitmap_t;
1196}
1197extern "C" {
1198 #[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."]
1199 pub fn roaring64_bitmap_flip_inplace(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1200}
1201extern "C" {
1202 #[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."]
1203 pub fn roaring64_bitmap_flip_closed_inplace(r: *mut roaring64_bitmap_t, min: u64, max: u64);
1204}
1205extern "C" {
1206 #[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"]
1207 pub fn roaring64_bitmap_portable_size_in_bytes(r: *const roaring64_bitmap_t) -> usize;
1208}
1209extern "C" {
1210 #[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."]
1211 pub fn roaring64_bitmap_portable_serialize(
1212 r: *const roaring64_bitmap_t,
1213 buf: *mut ::core::ffi::c_char,
1214 ) -> usize;
1215}
1216extern "C" {
1217 #[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"]
1218 pub fn roaring64_bitmap_portable_deserialize_size(
1219 buf: *const ::core::ffi::c_char,
1220 maxbytes: usize,
1221 ) -> usize;
1222}
1223extern "C" {
1224 #[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."]
1225 pub fn roaring64_bitmap_portable_deserialize_safe(
1226 buf: *const ::core::ffi::c_char,
1227 maxbytes: usize,
1228 ) -> *mut roaring64_bitmap_t;
1229}
1230extern "C" {
1231 #[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."]
1232 pub fn roaring64_bitmap_frozen_size_in_bytes(r: *const roaring64_bitmap_t) -> usize;
1233}
1234extern "C" {
1235 #[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."]
1236 pub fn roaring64_bitmap_frozen_serialize(
1237 r: *const roaring64_bitmap_t,
1238 buf: *mut ::core::ffi::c_char,
1239 ) -> usize;
1240}
1241extern "C" {
1242 #[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."]
1243 pub fn roaring64_bitmap_frozen_view(
1244 buf: *const ::core::ffi::c_char,
1245 maxbytes: usize,
1246 ) -> *mut roaring64_bitmap_t;
1247}
1248extern "C" {
1249 #[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."]
1250 pub fn roaring64_bitmap_iterate(
1251 r: *const roaring64_bitmap_t,
1252 iterator: roaring_iterator64,
1253 ptr: *mut ::core::ffi::c_void,
1254 ) -> bool;
1255}
1256extern "C" {
1257 #[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 ```"]
1258 pub fn roaring64_bitmap_to_uint64_array(r: *const roaring64_bitmap_t, out: *mut u64);
1259}
1260extern "C" {
1261 #[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()`."]
1262 pub fn roaring64_iterator_create(r: *const roaring64_bitmap_t) -> *mut roaring64_iterator_t;
1263}
1264extern "C" {
1265 #[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()`."]
1266 pub fn roaring64_iterator_create_last(
1267 r: *const roaring64_bitmap_t,
1268 ) -> *mut roaring64_iterator_t;
1269}
1270extern "C" {
1271 #[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create` without a allocation."]
1272 pub fn roaring64_iterator_reinit(r: *const roaring64_bitmap_t, it: *mut roaring64_iterator_t);
1273}
1274extern "C" {
1275 #[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create_last` without a allocation."]
1276 pub fn roaring64_iterator_reinit_last(
1277 r: *const roaring64_bitmap_t,
1278 it: *mut roaring64_iterator_t,
1279 );
1280}
1281extern "C" {
1282 #[doc = " Creates a copy of the iterator. Caller is responsible for calling\n `roaring64_iterator_free()` on the resulting iterator."]
1283 pub fn roaring64_iterator_copy(it: *const roaring64_iterator_t) -> *mut roaring64_iterator_t;
1284}
1285extern "C" {
1286 #[doc = " Free the iterator."]
1287 pub fn roaring64_iterator_free(it: *mut roaring64_iterator_t);
1288}
1289extern "C" {
1290 #[doc = " Returns true if the iterator currently points to a value. If so, calling\n `roaring64_iterator_value()` returns the value."]
1291 pub fn roaring64_iterator_has_value(it: *const roaring64_iterator_t) -> bool;
1292}
1293extern "C" {
1294 #[doc = " Returns the value the iterator currently points to. Should only be called if\n `roaring64_iterator_has_value()` returns true."]
1295 pub fn roaring64_iterator_value(it: *const roaring64_iterator_t) -> u64;
1296}
1297extern "C" {
1298 #[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."]
1299 pub fn roaring64_iterator_advance(it: *mut roaring64_iterator_t) -> bool;
1300}
1301extern "C" {
1302 #[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."]
1303 pub fn roaring64_iterator_previous(it: *mut roaring64_iterator_t) -> bool;
1304}
1305extern "C" {
1306 #[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()`."]
1307 pub fn roaring64_iterator_move_equalorlarger(it: *mut roaring64_iterator_t, val: u64) -> bool;
1308}
1309extern "C" {
1310 #[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."]
1311 pub fn roaring64_iterator_read(it: *mut roaring64_iterator_t, buf: *mut u64, count: u64)
1312 -> u64;
1313}