1pub const ROARING_VERSION: &[u8; 6] = b"4.2.3\0";
4pub const ROARING_VERSION_MAJOR: _bindgen_ty_1 = 4;
5pub const ROARING_VERSION_MINOR: _bindgen_ty_1 = 2;
6pub const ROARING_VERSION_REVISION: _bindgen_ty_1 = 3;
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."]
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"]
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 pub fn roaring_bitmap_add_offset(
250 bm: *const roaring_bitmap_t,
251 offset: i64,
252 ) -> *mut roaring_bitmap_t;
253}
254extern "C" {
255 #[doc = " Describe the inner structure of the bitmap."]
256 pub fn roaring_bitmap_printf_describe(r: *const roaring_bitmap_t);
257}
258extern "C" {
259 #[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"]
260 pub fn roaring_bitmap_of(n: usize, ...) -> *mut roaring_bitmap_t;
261}
262extern "C" {
263 #[doc = " Copies a bitmap (this does memory allocation).\n The caller is responsible for memory management."]
264 pub fn roaring_bitmap_copy(r: *const roaring_bitmap_t) -> *mut roaring_bitmap_t;
265}
266extern "C" {
267 #[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)."]
268 pub fn roaring_bitmap_overwrite(
269 dest: *mut roaring_bitmap_t,
270 src: *const roaring_bitmap_t,
271 ) -> bool;
272}
273extern "C" {
274 #[doc = " Print the content of the bitmap."]
275 pub fn roaring_bitmap_printf(r: *const roaring_bitmap_t);
276}
277extern "C" {
278 #[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."]
279 pub fn roaring_bitmap_and(
280 r1: *const roaring_bitmap_t,
281 r2: *const roaring_bitmap_t,
282 ) -> *mut roaring_bitmap_t;
283}
284extern "C" {
285 #[doc = " Computes the size of the intersection between two bitmaps."]
286 pub fn roaring_bitmap_and_cardinality(
287 r1: *const roaring_bitmap_t,
288 r2: *const roaring_bitmap_t,
289 ) -> u64;
290}
291extern "C" {
292 #[doc = " Check whether two bitmaps intersect."]
293 pub fn roaring_bitmap_intersect(
294 r1: *const roaring_bitmap_t,
295 r2: *const roaring_bitmap_t,
296 ) -> bool;
297}
298extern "C" {
299 #[doc = " Check whether a bitmap and an open range intersect."]
300 pub fn roaring_bitmap_intersect_with_range(bm: *const roaring_bitmap_t, x: u64, y: u64)
301 -> bool;
302}
303extern "C" {
304 #[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."]
305 pub fn roaring_bitmap_jaccard_index(
306 r1: *const roaring_bitmap_t,
307 r2: *const roaring_bitmap_t,
308 ) -> f64;
309}
310extern "C" {
311 #[doc = " Computes the size of the union between two bitmaps."]
312 pub fn roaring_bitmap_or_cardinality(
313 r1: *const roaring_bitmap_t,
314 r2: *const roaring_bitmap_t,
315 ) -> u64;
316}
317extern "C" {
318 #[doc = " Computes the size of the difference (andnot) between two bitmaps."]
319 pub fn roaring_bitmap_andnot_cardinality(
320 r1: *const roaring_bitmap_t,
321 r2: *const roaring_bitmap_t,
322 ) -> u64;
323}
324extern "C" {
325 #[doc = " Computes the size of the symmetric difference (xor) between two bitmaps."]
326 pub fn roaring_bitmap_xor_cardinality(
327 r1: *const roaring_bitmap_t,
328 r2: *const roaring_bitmap_t,
329 ) -> u64;
330}
331extern "C" {
332 #[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."]
333 pub fn roaring_bitmap_and_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
334}
335extern "C" {
336 #[doc = " Computes the union between two bitmaps and returns new bitmap. The caller is\n responsible for memory management."]
337 pub fn roaring_bitmap_or(
338 r1: *const roaring_bitmap_t,
339 r2: *const roaring_bitmap_t,
340 ) -> *mut roaring_bitmap_t;
341}
342extern "C" {
343 #[doc = " Inplace version of `roaring_bitmap_or(), modifies r1.\n TODO: decide whether r1 == r2 ok"]
344 pub fn roaring_bitmap_or_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
345}
346extern "C" {
347 #[doc = " Compute the union of 'number' bitmaps.\n Caller is responsible for freeing the result.\n See also `roaring_bitmap_or_many_heap()`"]
348 pub fn roaring_bitmap_or_many(
349 number: usize,
350 rs: *mut *const roaring_bitmap_t,
351 ) -> *mut roaring_bitmap_t;
352}
353extern "C" {
354 #[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."]
355 pub fn roaring_bitmap_or_many_heap(
356 number: u32,
357 rs: *mut *const roaring_bitmap_t,
358 ) -> *mut roaring_bitmap_t;
359}
360extern "C" {
361 #[doc = " Computes the symmetric difference (xor) between two bitmaps\n and returns new bitmap. The caller is responsible for memory management."]
362 pub fn roaring_bitmap_xor(
363 r1: *const roaring_bitmap_t,
364 r2: *const roaring_bitmap_t,
365 ) -> *mut roaring_bitmap_t;
366}
367extern "C" {
368 #[doc = " Inplace version of roaring_bitmap_xor, modifies r1, r1 != r2."]
369 pub fn roaring_bitmap_xor_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
370}
371extern "C" {
372 #[doc = " Compute the xor of 'number' bitmaps.\n Caller is responsible for freeing the result."]
373 pub fn roaring_bitmap_xor_many(
374 number: usize,
375 rs: *mut *const roaring_bitmap_t,
376 ) -> *mut roaring_bitmap_t;
377}
378extern "C" {
379 #[doc = " Computes the difference (andnot) between two bitmaps and returns new bitmap.\n Caller is responsible for freeing the result."]
380 pub fn roaring_bitmap_andnot(
381 r1: *const roaring_bitmap_t,
382 r2: *const roaring_bitmap_t,
383 ) -> *mut roaring_bitmap_t;
384}
385extern "C" {
386 #[doc = " Inplace version of roaring_bitmap_andnot, modifies r1, r1 != r2."]
387 pub fn roaring_bitmap_andnot_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
388}
389extern "C" {
390 #[doc = " Frees the memory."]
391 pub fn roaring_bitmap_free(r: *const roaring_bitmap_t);
392}
393#[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."]
394#[repr(C)]
395#[derive(Debug, Copy, Clone)]
396pub struct roaring_bulk_context_s {
397 pub container: *mut ::core::ffi::c_void,
398 pub idx: ::core::ffi::c_int,
399 pub key: u16,
400 pub typecode: u8,
401}
402#[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."]
403pub type roaring_bulk_context_t = roaring_bulk_context_s;
404extern "C" {
405 #[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."]
406 pub fn roaring_bitmap_add_bulk(
407 r: *mut roaring_bitmap_t,
408 context: *mut roaring_bulk_context_t,
409 val: u32,
410 );
411}
412extern "C" {
413 #[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`"]
414 pub fn roaring_bitmap_add_many(r: *mut roaring_bitmap_t, n_args: usize, vals: *const u32);
415}
416extern "C" {
417 #[doc = " Add value x"]
418 pub fn roaring_bitmap_add(r: *mut roaring_bitmap_t, x: u32);
419}
420extern "C" {
421 #[doc = " Add value x\n Returns true if a new value was added, false if the value already existed."]
422 pub fn roaring_bitmap_add_checked(r: *mut roaring_bitmap_t, x: u32) -> bool;
423}
424extern "C" {
425 #[doc = " Add all values in range [min, max]"]
426 pub fn roaring_bitmap_add_range_closed(r: *mut roaring_bitmap_t, min: u32, max: u32);
427}
428extern "C" {
429 #[doc = " Add all values in range [min, max)"]
430 pub fn roaring_bitmap_add_range(r: *mut roaring_bitmap_t, min: u64, max: u64);
431}
432extern "C" {
433 #[doc = " Remove value x"]
434 pub fn roaring_bitmap_remove(r: *mut roaring_bitmap_t, x: u32);
435}
436extern "C" {
437 #[doc = " Remove all values in range [min, max]"]
438 pub fn roaring_bitmap_remove_range_closed(r: *mut roaring_bitmap_t, min: u32, max: u32);
439}
440extern "C" {
441 #[doc = " Remove all values in range [min, max)"]
442 pub fn roaring_bitmap_remove_range(r: *mut roaring_bitmap_t, min: u64, max: u64);
443}
444extern "C" {
445 #[doc = " Remove multiple values"]
446 pub fn roaring_bitmap_remove_many(r: *mut roaring_bitmap_t, n_args: usize, vals: *const u32);
447}
448extern "C" {
449 #[doc = " Remove value x\n Returns true if a new value was removed, false if the value was not existing."]
450 pub fn roaring_bitmap_remove_checked(r: *mut roaring_bitmap_t, x: u32) -> bool;
451}
452extern "C" {
453 #[doc = " Check if value is present"]
454 pub fn roaring_bitmap_contains(r: *const roaring_bitmap_t, val: u32) -> bool;
455}
456extern "C" {
457 #[doc = " Check whether a range of values from range_start (included)\n to range_end (excluded) is present"]
458 pub fn roaring_bitmap_contains_range(
459 r: *const roaring_bitmap_t,
460 range_start: u64,
461 range_end: u64,
462 ) -> bool;
463}
464extern "C" {
465 #[doc = " Check whether a range of values from range_start (included)\n to range_end (included) is present"]
466 pub fn roaring_bitmap_contains_range_closed(
467 r: *const roaring_bitmap_t,
468 range_start: u32,
469 range_end: u32,
470 ) -> bool;
471}
472extern "C" {
473 #[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."]
474 pub fn roaring_bitmap_contains_bulk(
475 r: *const roaring_bitmap_t,
476 context: *mut roaring_bulk_context_t,
477 val: u32,
478 ) -> bool;
479}
480extern "C" {
481 #[doc = " Get the cardinality of the bitmap (number of elements)."]
482 pub fn roaring_bitmap_get_cardinality(r: *const roaring_bitmap_t) -> u64;
483}
484extern "C" {
485 #[doc = " Returns the number of elements in the range [range_start, range_end)."]
486 pub fn roaring_bitmap_range_cardinality(
487 r: *const roaring_bitmap_t,
488 range_start: u64,
489 range_end: u64,
490 ) -> u64;
491}
492extern "C" {
493 #[doc = " Returns the number of elements in the range [range_start, range_end]."]
494 pub fn roaring_bitmap_range_cardinality_closed(
495 r: *const roaring_bitmap_t,
496 range_start: u32,
497 range_end: u32,
498 ) -> u64;
499}
500extern "C" {
501 #[doc = " Returns true if the bitmap is empty (cardinality is zero)."]
502 pub fn roaring_bitmap_is_empty(r: *const roaring_bitmap_t) -> bool;
503}
504extern "C" {
505 #[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)"]
506 pub fn roaring_bitmap_clear(r: *mut roaring_bitmap_t);
507}
508extern "C" {
509 #[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));"]
510 pub fn roaring_bitmap_to_uint32_array(r: *const roaring_bitmap_t, ans: *mut u32);
511}
512extern "C" {
513 #[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"]
514 pub fn roaring_bitmap_to_bitset(r: *const roaring_bitmap_t, bitset: *mut bitset_t) -> bool;
515}
516extern "C" {
517 #[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)"]
518 pub fn roaring_bitmap_range_uint32_array(
519 r: *const roaring_bitmap_t,
520 offset: usize,
521 limit: usize,
522 ans: *mut u32,
523 ) -> bool;
524}
525extern "C" {
526 #[doc = " Remove run-length encoding even when it is more space efficient.\n Return whether a change was applied."]
527 pub fn roaring_bitmap_remove_run_compression(r: *mut roaring_bitmap_t) -> bool;
528}
529extern "C" {
530 #[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()`."]
531 pub fn roaring_bitmap_run_optimize(r: *mut roaring_bitmap_t) -> bool;
532}
533extern "C" {
534 #[doc = " If needed, reallocate memory to shrink the memory usage.\n Returns the number of bytes saved."]
535 pub fn roaring_bitmap_shrink_to_fit(r: *mut roaring_bitmap_t) -> usize;
536}
537extern "C" {
538 #[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."]
539 pub fn roaring_bitmap_serialize(
540 r: *const roaring_bitmap_t,
541 buf: *mut ::core::ffi::c_char,
542 ) -> usize;
543}
544extern "C" {
545 #[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."]
546 pub fn roaring_bitmap_deserialize(buf: *const ::core::ffi::c_void) -> *mut roaring_bitmap_t;
547}
548extern "C" {
549 #[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."]
550 pub fn roaring_bitmap_deserialize_safe(
551 buf: *const ::core::ffi::c_void,
552 maxbytes: usize,
553 ) -> *mut roaring_bitmap_t;
554}
555extern "C" {
556 #[doc = " How many bytes are required to serialize this bitmap (NOT compatible\n with Java and Go versions)"]
557 pub fn roaring_bitmap_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
558}
559extern "C" {
560 #[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."]
561 pub fn roaring_bitmap_portable_deserialize(
562 buf: *const ::core::ffi::c_char,
563 ) -> *mut roaring_bitmap_t;
564}
565extern "C" {
566 #[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."]
567 pub fn roaring_bitmap_portable_deserialize_safe(
568 buf: *const ::core::ffi::c_char,
569 maxbytes: usize,
570 ) -> *mut roaring_bitmap_t;
571}
572extern "C" {
573 #[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."]
574 pub fn roaring_bitmap_portable_deserialize_frozen(
575 buf: *const ::core::ffi::c_char,
576 ) -> *mut roaring_bitmap_t;
577}
578extern "C" {
579 #[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"]
580 pub fn roaring_bitmap_portable_deserialize_size(
581 buf: *const ::core::ffi::c_char,
582 maxbytes: usize,
583 ) -> usize;
584}
585extern "C" {
586 #[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"]
587 pub fn roaring_bitmap_portable_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
588}
589extern "C" {
590 #[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."]
591 pub fn roaring_bitmap_portable_serialize(
592 r: *const roaring_bitmap_t,
593 buf: *mut ::core::ffi::c_char,
594 ) -> usize;
595}
596extern "C" {
597 #[doc = " Returns number of bytes required to serialize bitmap using frozen format."]
598 pub fn roaring_bitmap_frozen_size_in_bytes(r: *const roaring_bitmap_t) -> usize;
599}
600extern "C" {
601 #[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."]
602 pub fn roaring_bitmap_frozen_serialize(
603 r: *const roaring_bitmap_t,
604 buf: *mut ::core::ffi::c_char,
605 );
606}
607extern "C" {
608 #[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."]
609 pub fn roaring_bitmap_frozen_view(
610 buf: *const ::core::ffi::c_char,
611 length: usize,
612 ) -> *const roaring_bitmap_t;
613}
614extern "C" {
615 #[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."]
616 pub fn roaring_iterate(
617 r: *const roaring_bitmap_t,
618 iterator: roaring_iterator,
619 ptr: *mut ::core::ffi::c_void,
620 ) -> bool;
621}
622extern "C" {
623 pub fn roaring_iterate64(
624 r: *const roaring_bitmap_t,
625 iterator: roaring_iterator64,
626 high_bits: u64,
627 ptr: *mut ::core::ffi::c_void,
628 ) -> bool;
629}
630extern "C" {
631 #[doc = " Return true if the two bitmaps contain the same elements."]
632 pub fn roaring_bitmap_equals(r1: *const roaring_bitmap_t, r2: *const roaring_bitmap_t) -> bool;
633}
634extern "C" {
635 #[doc = " Return true if all the elements of r1 are also in r2."]
636 pub fn roaring_bitmap_is_subset(
637 r1: *const roaring_bitmap_t,
638 r2: *const roaring_bitmap_t,
639 ) -> bool;
640}
641extern "C" {
642 #[doc = " Return true if all the elements of r1 are also in r2, and r2 is strictly\n greater than r1."]
643 pub fn roaring_bitmap_is_strict_subset(
644 r1: *const roaring_bitmap_t,
645 r2: *const roaring_bitmap_t,
646 ) -> bool;
647}
648extern "C" {
649 #[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."]
650 pub fn roaring_bitmap_lazy_or(
651 r1: *const roaring_bitmap_t,
652 r2: *const roaring_bitmap_t,
653 bitsetconversion: bool,
654 ) -> *mut roaring_bitmap_t;
655}
656extern "C" {
657 #[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."]
658 pub fn roaring_bitmap_lazy_or_inplace(
659 r1: *mut roaring_bitmap_t,
660 r2: *const roaring_bitmap_t,
661 bitsetconversion: bool,
662 );
663}
664extern "C" {
665 #[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()`."]
666 pub fn roaring_bitmap_repair_after_lazy(r1: *mut roaring_bitmap_t);
667}
668extern "C" {
669 #[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."]
670 pub fn roaring_bitmap_lazy_xor(
671 r1: *const roaring_bitmap_t,
672 r2: *const roaring_bitmap_t,
673 ) -> *mut roaring_bitmap_t;
674}
675extern "C" {
676 #[doc = " (For expert users who seek high performance.)\n\n Inplace version of roaring_bitmap_lazy_xor, modifies r1. r1 != r2"]
677 pub fn roaring_bitmap_lazy_xor_inplace(r1: *mut roaring_bitmap_t, r2: *const roaring_bitmap_t);
678}
679extern "C" {
680 #[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."]
681 pub fn roaring_bitmap_flip(
682 r1: *const roaring_bitmap_t,
683 range_start: u64,
684 range_end: u64,
685 ) -> *mut roaring_bitmap_t;
686}
687extern "C" {
688 #[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."]
689 pub fn roaring_bitmap_flip_closed(
690 x1: *const roaring_bitmap_t,
691 range_start: u32,
692 range_end: u32,
693 ) -> *mut roaring_bitmap_t;
694}
695extern "C" {
696 #[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."]
697 pub fn roaring_bitmap_flip_inplace(r1: *mut roaring_bitmap_t, range_start: u64, range_end: u64);
698}
699extern "C" {
700 #[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."]
701 pub fn roaring_bitmap_flip_inplace_closed(
702 r1: *mut roaring_bitmap_t,
703 range_start: u32,
704 range_end: u32,
705 );
706}
707extern "C" {
708 #[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."]
709 pub fn roaring_bitmap_select(r: *const roaring_bitmap_t, rank: u32, element: *mut u32) -> bool;
710}
711extern "C" {
712 #[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."]
713 pub fn roaring_bitmap_rank(r: *const roaring_bitmap_t, x: u32) -> u64;
714}
715extern "C" {
716 #[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));"]
717 pub fn roaring_bitmap_rank_many(
718 r: *const roaring_bitmap_t,
719 begin: *const u32,
720 end: *const u32,
721 ans: *mut u64,
722 );
723}
724extern "C" {
725 #[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."]
726 pub fn roaring_bitmap_get_index(r: *const roaring_bitmap_t, x: u32) -> i64;
727}
728extern "C" {
729 #[doc = " Returns the smallest value in the set, or UINT32_MAX if the set is empty."]
730 pub fn roaring_bitmap_minimum(r: *const roaring_bitmap_t) -> u32;
731}
732extern "C" {
733 #[doc = " Returns the greatest value in the set, or 0 if the set is empty."]
734 pub fn roaring_bitmap_maximum(r: *const roaring_bitmap_t) -> u32;
735}
736extern "C" {
737 #[doc = " (For advanced users.)\n\n Collect statistics about the bitmap, see roaring_types.h for\n a description of roaring_statistics_t"]
738 pub fn roaring_bitmap_statistics(r: *const roaring_bitmap_t, stat: *mut roaring_statistics_t);
739}
740extern "C" {
741 #[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."]
742 pub fn roaring_bitmap_internal_validate(
743 r: *const roaring_bitmap_t,
744 reason: *mut *const ::core::ffi::c_char,
745 ) -> bool;
746}
747#[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."]
748#[repr(C)]
749#[derive(Debug, Copy, Clone)]
750pub struct roaring_uint32_iterator_s {
751 pub parent: *const roaring_bitmap_t,
752 pub container: *const ::core::ffi::c_void,
753 pub typecode: u8,
754 pub container_index: i32,
755 pub highbits: u32,
756 pub container_it: roaring_container_iterator_t,
757 pub current_value: u32,
758 pub has_value: bool,
759}
760#[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."]
761pub type roaring_uint32_iterator_t = roaring_uint32_iterator_s;
762extern "C" {
763 #[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`."]
764 pub fn roaring_iterator_init(r: *const roaring_bitmap_t, newit: *mut roaring_uint32_iterator_t);
765}
766extern "C" {
767 #[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`."]
768 pub fn roaring_iterator_init_last(
769 r: *const roaring_bitmap_t,
770 newit: *mut roaring_uint32_iterator_t,
771 );
772}
773extern "C" {
774 #[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`."]
775 pub fn roaring_iterator_create(r: *const roaring_bitmap_t) -> *mut roaring_uint32_iterator_t;
776}
777extern "C" {
778 #[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."]
779 pub fn roaring_uint32_iterator_advance(it: *mut roaring_uint32_iterator_t) -> bool;
780}
781extern "C" {
782 #[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."]
783 pub fn roaring_uint32_iterator_previous(it: *mut roaring_uint32_iterator_t) -> bool;
784}
785extern "C" {
786 #[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`."]
787 pub fn roaring_uint32_iterator_move_equalorlarger(
788 it: *mut roaring_uint32_iterator_t,
789 val: u32,
790 ) -> bool;
791}
792extern "C" {
793 #[doc = " Creates a copy of an iterator.\n Caller must free it."]
794 pub fn roaring_uint32_iterator_copy(
795 it: *const roaring_uint32_iterator_t,
796 ) -> *mut roaring_uint32_iterator_t;
797}
798extern "C" {
799 #[doc = " Free memory following `roaring_iterator_create()`"]
800 pub fn roaring_uint32_iterator_free(it: *mut roaring_uint32_iterator_t);
801}
802extern "C" {
803 pub fn roaring_uint32_iterator_read(
804 it: *mut roaring_uint32_iterator_t,
805 buf: *mut u32,
806 count: u32,
807 ) -> u32;
808}
809pub type roaring_malloc_p =
810 ::core::option::Option<unsafe extern "C" fn(arg1: usize) -> *mut ::core::ffi::c_void>;
811pub type roaring_realloc_p = ::core::option::Option<
812 unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void, arg2: usize) -> *mut ::core::ffi::c_void,
813>;
814pub type roaring_calloc_p = ::core::option::Option<
815 unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
816>;
817pub type roaring_free_p =
818 ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>;
819pub type roaring_aligned_malloc_p = ::core::option::Option<
820 unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
821>;
822pub type roaring_aligned_free_p =
823 ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>;
824#[repr(C)]
825#[derive(Debug, Copy, Clone)]
826pub struct roaring_memory_s {
827 pub malloc: roaring_malloc_p,
828 pub realloc: roaring_realloc_p,
829 pub calloc: roaring_calloc_p,
830 pub free: roaring_free_p,
831 pub aligned_malloc: roaring_aligned_malloc_p,
832 pub aligned_free: roaring_aligned_free_p,
833}
834pub type roaring_memory_t = roaring_memory_s;
835extern "C" {
836 pub fn roaring_init_memory_hook(memory_hook: roaring_memory_t);
837}
838extern "C" {
839 pub fn roaring_malloc(arg1: usize) -> *mut ::core::ffi::c_void;
840}
841extern "C" {
842 pub fn roaring_realloc(arg1: *mut ::core::ffi::c_void, arg2: usize)
843 -> *mut ::core::ffi::c_void;
844}
845extern "C" {
846 pub fn roaring_calloc(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void;
847}
848extern "C" {
849 pub fn roaring_free(arg1: *mut ::core::ffi::c_void);
850}
851extern "C" {
852 pub fn roaring_aligned_malloc(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void;
853}
854extern "C" {
855 pub fn roaring_aligned_free(arg1: *mut ::core::ffi::c_void);
856}
857#[repr(C)]
858#[derive(Debug, Copy, Clone)]
859pub struct roaring64_bitmap_s {
860 _unused: [u8; 0],
861}
862pub type roaring64_bitmap_t = roaring64_bitmap_s;
863#[repr(C)]
864#[derive(Debug, Copy, Clone)]
865pub struct roaring64_leaf_s {
866 _unused: [u8; 0],
867}
868pub type roaring64_leaf_t = roaring64_leaf_s;
869#[repr(C)]
870#[derive(Debug, Copy, Clone)]
871pub struct roaring64_iterator_s {
872 _unused: [u8; 0],
873}
874pub type roaring64_iterator_t = roaring64_iterator_s;
875#[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."]
876#[repr(C)]
877#[derive(Debug, Copy, Clone)]
878pub struct roaring64_bulk_context_s {
879 pub high_bytes: [u8; 6usize],
880 pub leaf: *mut roaring64_leaf_t,
881}
882#[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."]
883pub type roaring64_bulk_context_t = roaring64_bulk_context_s;
884extern "C" {
885 #[doc = " Dynamically allocates a new bitmap (initially empty).\n Client is responsible for calling `roaring64_bitmap_free()`."]
886 pub fn roaring64_bitmap_create() -> *mut roaring64_bitmap_t;
887}
888extern "C" {
889 pub fn roaring64_bitmap_free(r: *mut roaring64_bitmap_t);
890}
891extern "C" {
892 #[doc = " Returns a copy of a bitmap."]
893 pub fn roaring64_bitmap_copy(r: *const roaring64_bitmap_t) -> *mut roaring64_bitmap_t;
894}
895extern "C" {
896 #[doc = " Creates a new bitmap of a pointer to N 64-bit integers."]
897 pub fn roaring64_bitmap_of_ptr(n_args: usize, vals: *const u64) -> *mut roaring64_bitmap_t;
898}
899extern "C" {
900 #[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."]
901 pub fn roaring64_bitmap_move_from_roaring32(
902 r: *mut roaring_bitmap_t,
903 ) -> *mut roaring64_bitmap_t;
904}
905extern "C" {
906 #[doc = " Create a new bitmap containing all the values in [min, max) that are at a\n distance k*step from min."]
907 pub fn roaring64_bitmap_from_range(min: u64, max: u64, step: u64) -> *mut roaring64_bitmap_t;
908}
909extern "C" {
910 #[doc = " Adds the provided value to the bitmap."]
911 pub fn roaring64_bitmap_add(r: *mut roaring64_bitmap_t, val: u64);
912}
913extern "C" {
914 #[doc = " Adds the provided value to the bitmap.\n Returns true if a new value was added, false if the value already existed."]
915 pub fn roaring64_bitmap_add_checked(r: *mut roaring64_bitmap_t, val: u64) -> bool;
916}
917extern "C" {
918 #[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."]
919 pub fn roaring64_bitmap_add_bulk(
920 r: *mut roaring64_bitmap_t,
921 context: *mut roaring64_bulk_context_t,
922 val: u64,
923 );
924}
925extern "C" {
926 #[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`."]
927 pub fn roaring64_bitmap_add_many(r: *mut roaring64_bitmap_t, n_args: usize, vals: *const u64);
928}
929extern "C" {
930 #[doc = " Add all values in range [min, max)."]
931 pub fn roaring64_bitmap_add_range(r: *mut roaring64_bitmap_t, min: u64, max: u64);
932}
933extern "C" {
934 #[doc = " Add all values in range [min, max]."]
935 pub fn roaring64_bitmap_add_range_closed(r: *mut roaring64_bitmap_t, min: u64, max: u64);
936}
937extern "C" {
938 #[doc = " Removes a value from the bitmap if present."]
939 pub fn roaring64_bitmap_remove(r: *mut roaring64_bitmap_t, val: u64);
940}
941extern "C" {
942 #[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."]
943 pub fn roaring64_bitmap_remove_checked(r: *mut roaring64_bitmap_t, val: u64) -> bool;
944}
945extern "C" {
946 #[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."]
947 pub fn roaring64_bitmap_remove_bulk(
948 r: *mut roaring64_bitmap_t,
949 context: *mut roaring64_bulk_context_t,
950 val: u64,
951 );
952}
953extern "C" {
954 #[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`."]
955 pub fn roaring64_bitmap_remove_many(
956 r: *mut roaring64_bitmap_t,
957 n_args: usize,
958 vals: *const u64,
959 );
960}
961extern "C" {
962 #[doc = " Remove all values in range [min, max)."]
963 pub fn roaring64_bitmap_remove_range(r: *mut roaring64_bitmap_t, min: u64, max: u64);
964}
965extern "C" {
966 #[doc = " Remove all values in range [min, max]."]
967 pub fn roaring64_bitmap_remove_range_closed(r: *mut roaring64_bitmap_t, min: u64, max: u64);
968}
969extern "C" {
970 #[doc = " Empties the bitmap."]
971 pub fn roaring64_bitmap_clear(r: *mut roaring64_bitmap_t);
972}
973extern "C" {
974 #[doc = " Returns true if the provided value is present."]
975 pub fn roaring64_bitmap_contains(r: *const roaring64_bitmap_t, val: u64) -> bool;
976}
977extern "C" {
978 #[doc = " Returns true if all values in the range [min, max) are present."]
979 pub fn roaring64_bitmap_contains_range(
980 r: *const roaring64_bitmap_t,
981 min: u64,
982 max: u64,
983 ) -> bool;
984}
985extern "C" {
986 #[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."]
987 pub fn roaring64_bitmap_contains_bulk(
988 r: *const roaring64_bitmap_t,
989 context: *mut roaring64_bulk_context_t,
990 val: u64,
991 ) -> bool;
992}
993extern "C" {
994 #[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."]
995 pub fn roaring64_bitmap_select(
996 r: *const roaring64_bitmap_t,
997 rank: u64,
998 element: *mut u64,
999 ) -> bool;
1000}
1001extern "C" {
1002 #[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."]
1003 pub fn roaring64_bitmap_rank(r: *const roaring64_bitmap_t, val: u64) -> u64;
1004}
1005extern "C" {
1006 #[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."]
1007 pub fn roaring64_bitmap_get_index(
1008 r: *const roaring64_bitmap_t,
1009 val: u64,
1010 out_index: *mut u64,
1011 ) -> bool;
1012}
1013extern "C" {
1014 #[doc = " Returns the number of values in the bitmap."]
1015 pub fn roaring64_bitmap_get_cardinality(r: *const roaring64_bitmap_t) -> u64;
1016}
1017extern "C" {
1018 #[doc = " Returns the number of elements in the range [min, max)."]
1019 pub fn roaring64_bitmap_range_cardinality(
1020 r: *const roaring64_bitmap_t,
1021 min: u64,
1022 max: u64,
1023 ) -> u64;
1024}
1025extern "C" {
1026 #[doc = " Returns the number of elements in the range [min, max]"]
1027 pub fn roaring64_bitmap_range_closed_cardinality(
1028 r: *const roaring64_bitmap_t,
1029 min: u64,
1030 max: u64,
1031 ) -> u64;
1032}
1033extern "C" {
1034 #[doc = " Returns true if the bitmap is empty (cardinality is zero)."]
1035 pub fn roaring64_bitmap_is_empty(r: *const roaring64_bitmap_t) -> bool;
1036}
1037extern "C" {
1038 #[doc = " Returns the smallest value in the set, or UINT64_MAX if the set is empty."]
1039 pub fn roaring64_bitmap_minimum(r: *const roaring64_bitmap_t) -> u64;
1040}
1041extern "C" {
1042 #[doc = " Returns the largest value in the set, or 0 if empty."]
1043 pub fn roaring64_bitmap_maximum(r: *const roaring64_bitmap_t) -> u64;
1044}
1045extern "C" {
1046 #[doc = " Returns true if the result has at least one run container."]
1047 pub fn roaring64_bitmap_run_optimize(r: *mut roaring64_bitmap_t) -> bool;
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."]
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."]
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."]
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."]
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."]
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."]
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 = " 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."]
1232 pub fn roaring64_bitmap_iterate(
1233 r: *const roaring64_bitmap_t,
1234 iterator: roaring_iterator64,
1235 ptr: *mut ::core::ffi::c_void,
1236 ) -> bool;
1237}
1238extern "C" {
1239 #[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 ```"]
1240 pub fn roaring64_bitmap_to_uint64_array(r: *const roaring64_bitmap_t, out: *mut u64);
1241}
1242extern "C" {
1243 #[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()`."]
1244 pub fn roaring64_iterator_create(r: *const roaring64_bitmap_t) -> *mut roaring64_iterator_t;
1245}
1246extern "C" {
1247 #[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()`."]
1248 pub fn roaring64_iterator_create_last(
1249 r: *const roaring64_bitmap_t,
1250 ) -> *mut roaring64_iterator_t;
1251}
1252extern "C" {
1253 #[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create` without a allocation."]
1254 pub fn roaring64_iterator_reinit(r: *const roaring64_bitmap_t, it: *mut roaring64_iterator_t);
1255}
1256extern "C" {
1257 #[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create_last` without a allocation."]
1258 pub fn roaring64_iterator_reinit_last(
1259 r: *const roaring64_bitmap_t,
1260 it: *mut roaring64_iterator_t,
1261 );
1262}
1263extern "C" {
1264 #[doc = " Creates a copy of the iterator. Caller is responsible for calling\n `roaring64_iterator_free()` on the resulting iterator."]
1265 pub fn roaring64_iterator_copy(it: *const roaring64_iterator_t) -> *mut roaring64_iterator_t;
1266}
1267extern "C" {
1268 #[doc = " Free the iterator."]
1269 pub fn roaring64_iterator_free(it: *mut roaring64_iterator_t);
1270}
1271extern "C" {
1272 #[doc = " Returns true if the iterator currently points to a value. If so, calling\n `roaring64_iterator_value()` returns the value."]
1273 pub fn roaring64_iterator_has_value(it: *const roaring64_iterator_t) -> bool;
1274}
1275extern "C" {
1276 #[doc = " Returns the value the iterator currently points to. Should only be called if\n `roaring64_iterator_has_value()` returns true."]
1277 pub fn roaring64_iterator_value(it: *const roaring64_iterator_t) -> u64;
1278}
1279extern "C" {
1280 #[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."]
1281 pub fn roaring64_iterator_advance(it: *mut roaring64_iterator_t) -> bool;
1282}
1283extern "C" {
1284 #[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."]
1285 pub fn roaring64_iterator_previous(it: *mut roaring64_iterator_t) -> bool;
1286}
1287extern "C" {
1288 #[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()`."]
1289 pub fn roaring64_iterator_move_equalorlarger(it: *mut roaring64_iterator_t, val: u64) -> bool;
1290}
1291extern "C" {
1292 #[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."]
1293 pub fn roaring64_iterator_read(it: *mut roaring64_iterator_t, buf: *mut u64, count: u64)
1294 -> u64;
1295}