Skip to content

Commit

Permalink
update amalg & bindings again
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann committed Jan 19, 2024
1 parent 9ebc2cd commit c9867b4
Show file tree
Hide file tree
Showing 4 changed files with 958 additions and 121 deletions.
93 changes: 87 additions & 6 deletions croaring-sys/CRoaring/bindgen_bundled_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ extern "C" {
) -> *mut roaring_bitmap_t;
}
extern "C" {
#[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 overflows.\n However, for correct operations, it is assumed that the bitmap read was once\n serialized from a valid bitmap (i.e., it follows the format specification).\n If you provided an incorrect input (garbage), then the bitmap read may not be in\n a valid state and following operations may not lead to sensible results.\n In particular, the serialized array containers need to be in sorted order, and the\n run containers should be in sorted non-overlapping order. This is is guaranteed to\n happen when serializing an existing bitmap, but not for random inputs.\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),\n the data format is going to be big-endian and not compatible with little-endian systems."]
#[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 overflows.\n However, for correct operations, it is assumed that the bitmap read was once\n serialized from a valid bitmap (i.e., it follows the format specification).\n If you provided an incorrect input (garbage), then the bitmap read may not be in\n a valid state and following operations may not lead to sensible results.\n In particular, the serialized array containers need to be in sorted order, and the\n run containers should be in sorted non-overlapping order. This is is guaranteed to\n happen when serializing an existing bitmap, but not for random inputs.\n\n You may use roaring_bitmap_internal_validate to check the validity of the bitmap prior\n to using it. You may also use other strategies to check for corrupted inputs (e.g.,\n checksums).\n\n This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),\n the data format is going to be big-endian and not compatible with little-endian systems."]
pub fn roaring_bitmap_portable_deserialize_safe(
buf: *const ::std::os::raw::c_char,
maxbytes: usize,
Expand Down Expand Up @@ -682,7 +682,7 @@ extern "C" {
pub fn roaring_bitmap_statistics(r: *const roaring_bitmap_t, stat: *mut roaring_statistics_t);
}
extern "C" {
#[doc = " Perform internal consistency checks. Returns true if the bitmap is consistent.\n\n Note that some operations intentionally leave bitmaps in an inconsistent state temporarily,\n for example, `roaring_bitmap_lazy_*` functions, until `roaring_bitmap_repair_after_lazy` is called.\n\n If reason is non-null, it will be set to a string describing the first inconsistency found if any."]
#[doc = " Perform internal consistency checks. Returns true if the bitmap is consistent.\n It may be useful to call this after deserializing bitmaps from untrusted sources.\n If roaring_bitmap_internal_validate returns true, then the bitmap should be consistent\n and can be trusted not to cause crashes or memory corruption.\n\n Note that some operations intentionally leave bitmaps in an inconsistent state temporarily,\n for example, `roaring_bitmap_lazy_*` functions, until `roaring_bitmap_repair_after_lazy` is called.\n\n If reason is non-null, it will be set to a string describing the first inconsistency found if any."]
pub fn roaring_bitmap_internal_validate(
r: *const roaring_bitmap_t,
reason: *mut *const ::std::os::raw::c_char,
Expand Down Expand Up @@ -815,6 +815,12 @@ pub struct roaring64_leaf_s {
_unused: [u8; 0],
}
pub type roaring64_leaf_t = roaring64_leaf_s;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct roaring64_iterator_s {
_unused: [u8; 0],
}
pub type roaring64_iterator_t = roaring64_iterator_s;
#[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."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
Expand Down Expand Up @@ -959,10 +965,6 @@ extern "C" {
#[doc = " Returns true if the result has at least one run container."]
pub fn roaring64_bitmap_run_optimize(r: *mut roaring64_bitmap_t) -> bool;
}
extern "C" {
#[doc = " Returns the in-memory size of the bitmap.\n TODO: Return the serialized size."]
pub fn roaring64_bitmap_size_in_bytes(r: *const roaring64_bitmap_t) -> usize;
}
extern "C" {
#[doc = " Return true if the two bitmaps contain the same elements."]
pub fn roaring64_bitmap_equals(
Expand Down Expand Up @@ -1073,6 +1075,31 @@ extern "C" {
r2: *const roaring64_bitmap_t,
);
}
extern "C" {
#[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"]
pub fn roaring64_bitmap_portable_size_in_bytes(r: *const roaring64_bitmap_t) -> usize;
}
extern "C" {
#[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."]
pub fn roaring64_bitmap_portable_serialize(
r: *const roaring64_bitmap_t,
buf: *mut ::std::os::raw::c_char,
) -> usize;
}
extern "C" {
#[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"]
pub fn roaring64_bitmap_portable_deserialize_size(
buf: *const ::std::os::raw::c_char,
maxbytes: usize,
) -> usize;
}
extern "C" {
#[doc = " Read a 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 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. 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 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."]
pub fn roaring64_bitmap_portable_deserialize_safe(
buf: *const ::std::os::raw::c_char,
maxbytes: usize,
) -> *mut roaring64_bitmap_t;
}
extern "C" {
#[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."]
pub fn roaring64_bitmap_iterate(
Expand All @@ -1081,3 +1108,57 @@ extern "C" {
ptr: *mut ::std::os::raw::c_void,
) -> bool;
}
extern "C" {
#[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()`."]
pub fn roaring64_iterator_create(r: *const roaring64_bitmap_t) -> *mut roaring64_iterator_t;
}
extern "C" {
#[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()`."]
pub fn roaring64_iterator_create_last(
r: *const roaring64_bitmap_t,
) -> *mut roaring64_iterator_t;
}
extern "C" {
#[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create` without a allocation."]
pub fn roaring64_iterator_reinit(r: *const roaring64_bitmap_t, it: *mut roaring64_iterator_t);
}
extern "C" {
#[doc = " Re-initializes an existing iterator. Functionally the same as\n `roaring64_iterator_create_last` without a allocation."]
pub fn roaring64_iterator_reinit_last(
r: *const roaring64_bitmap_t,
it: *mut roaring64_iterator_t,
);
}
extern "C" {
#[doc = " Creates a copy of the iterator. Caller is responsible for calling\n `roaring64_iterator_free()` on the resulting iterator."]
pub fn roaring64_iterator_copy(it: *const roaring64_iterator_t) -> *mut roaring64_iterator_t;
}
extern "C" {
#[doc = " Free the iterator."]
pub fn roaring64_iterator_free(it: *mut roaring64_iterator_t);
}
extern "C" {
#[doc = " Returns true if the iterator currently points to a value. If so, calling\n `roaring64_iterator_value()` returns the value."]
pub fn roaring64_iterator_has_value(it: *const roaring64_iterator_t) -> bool;
}
extern "C" {
#[doc = " Returns the value the iterator currently points to. Should only be called if\n `roaring64_iterator_has_value()` returns true."]
pub fn roaring64_iterator_value(it: *const roaring64_iterator_t) -> u64;
}
extern "C" {
#[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."]
pub fn roaring64_iterator_advance(it: *mut roaring64_iterator_t) -> bool;
}
extern "C" {
#[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."]
pub fn roaring64_iterator_previous(it: *mut roaring64_iterator_t) -> bool;
}
extern "C" {
#[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()`."]
pub fn roaring64_iterator_move_equalorlarger(it: *mut roaring64_iterator_t, val: u64) -> bool;
}
extern "C" {
#[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."]
pub fn roaring64_iterator_read(it: *mut roaring64_iterator_t, buf: *mut u64, count: u64)
-> u64;
}
Loading

0 comments on commit c9867b4

Please sign in to comment.