Skip to content

Commit

Permalink
chore: update bindings to 4.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann committed Sep 5, 2024
1 parent f75467c commit d0730a3
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Current documentation is available at https://docs.rs/croaring/latest/croaring/

## CRoaring Version

This crate uses [CRoaring version `4.1.1`](https://github.com/RoaringBitmap/CRoaring/releases/tag/v4.1.1).
This crate uses [CRoaring version `4.1.2`](https://github.com/RoaringBitmap/CRoaring/releases/tag/v4.1.2).
The version of this crate does not necessarily match the version of CRoaring: the major version of the crate is only
incremented when there are breaking changes in the Rust API: It is possible (and has happened) that breaking changes
in the CRoaring C API do not necessitate a major version bump in this crate.
12 changes: 9 additions & 3 deletions croaring-sys/CRoaring/bindgen_bundled_version.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* automatically generated by rust-bindgen 0.69.4 */
/* automatically generated by rust-bindgen 0.70.1 */

pub const ROARING_VERSION: &[u8; 6] = b"4.1.1\0";
pub const ROARING_VERSION: &[u8; 6] = b"4.1.2\0";
pub const ROARING_VERSION_MAJOR: _bindgen_ty_1 = 4;
pub const ROARING_VERSION_MINOR: _bindgen_ty_1 = 1;
pub const ROARING_VERSION_REVISION: _bindgen_ty_1 = 1;
pub const ROARING_VERSION_REVISION: _bindgen_ty_1 = 2;
pub type _bindgen_ty_1 = ::core::ffi::c_uint;
extern "C" {
#[doc = " result might be undefined when input_num is zero"]
Expand Down Expand Up @@ -861,6 +861,12 @@ extern "C" {
#[doc = " Creates a new bitmap of a pointer to N 64-bit integers."]
pub fn roaring64_bitmap_of_ptr(n_args: usize, vals: *const u64) -> *mut roaring64_bitmap_t;
}
extern "C" {
#[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."]
pub fn roaring64_bitmap_move_from_roaring32(
r: *mut roaring_bitmap_t,
) -> *mut roaring64_bitmap_t;
}
extern "C" {
#[doc = " Create a new bitmap containing all the values in [min, max) that are at a\n distance k*step from min."]
pub fn roaring64_bitmap_from_range(min: u64, max: u64, step: u64) -> *mut roaring64_bitmap_t;
Expand Down
57 changes: 40 additions & 17 deletions croaring-sys/CRoaring/roaring.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
// Created by amalgamation.sh on 2024-07-30T19:32:00Z
// Created by amalgamation.sh on 2024-09-04T03:07:22Z

/*
* The CRoaring project is under a dual license (Apache/MIT).
Expand Down Expand Up @@ -22868,6 +22868,43 @@ roaring64_bitmap_t *roaring64_bitmap_copy(const roaring64_bitmap_t *r) {
return result;
}

/**
* Steal the containers from a 32-bit bitmap and insert them into a 64-bit
* bitmap (with an offset)
*
* After calling this function, the original bitmap will be empty, and the
* returned bitmap will contain all the values from the original bitmap.
*/
static void move_from_roaring32_offset(roaring64_bitmap_t *dst,
roaring_bitmap_t *src,
uint32_t high_bits) {
uint64_t key_base = ((uint64_t)high_bits) << 32;
uint32_t r32_size = ra_get_size(&src->high_low_container);
for (uint32_t i = 0; i < r32_size; ++i) {
uint16_t key = ra_get_key_at_index(&src->high_low_container, i);
uint8_t typecode;
container_t *container = ra_get_container_at_index(
&src->high_low_container, (uint16_t)i, &typecode);

uint8_t high48[ART_KEY_BYTES];
uint64_t high48_bits = key_base | ((uint64_t)key << 16);
split_key(high48_bits, high48);
leaf_t *leaf = create_leaf(container, typecode);
art_insert(&dst->art, high48, (art_val_t *)leaf);
}
// We stole all the containers, so leave behind a size of zero
src->high_low_container.size = 0;
}

roaring64_bitmap_t *roaring64_bitmap_move_from_roaring32(
roaring_bitmap_t *bitmap32) {
roaring64_bitmap_t *result = roaring64_bitmap_create();

move_from_roaring32_offset(result, bitmap32, 0);

return result;
}

roaring64_bitmap_t *roaring64_bitmap_from_range(uint64_t min, uint64_t max,
uint64_t step) {
if (step == 0 || max <= min) {
Expand Down Expand Up @@ -24637,22 +24674,8 @@ roaring64_bitmap_t *roaring64_bitmap_portable_deserialize_safe(
read_bytes += bitmap32_size;

// Insert all containers of the 32-bit bitmap into the 64-bit bitmap.
uint32_t r32_size = ra_get_size(&bitmap32->high_low_container);
for (size_t i = 0; i < r32_size; ++i) {
uint16_t key16 =
ra_get_key_at_index(&bitmap32->high_low_container, (uint16_t)i);
uint8_t typecode;
container_t *container = ra_get_container_at_index(
&bitmap32->high_low_container, (uint16_t)i, &typecode);

uint64_t high48_bits =
(((uint64_t)high32) << 32) | (((uint64_t)key16) << 16);
uint8_t high48[ART_KEY_BYTES];
split_key(high48_bits, high48);
leaf_t *leaf = create_leaf(container, typecode);
art_insert(&r->art, high48, (art_val_t *)leaf);
}
roaring_bitmap_free_without_containers(bitmap32);
move_from_roaring32_offset(r, bitmap32, high32);
roaring_bitmap_free(bitmap32);
}
return r;
}
Expand Down
20 changes: 15 additions & 5 deletions croaring-sys/CRoaring/roaring.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
// Created by amalgamation.sh on 2024-07-30T19:32:00Z
// Created by amalgamation.sh on 2024-09-04T03:07:22Z

/*
* The CRoaring project is under a dual license (Apache/MIT).
Expand Down Expand Up @@ -59,11 +59,11 @@
// /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand
#ifndef ROARING_INCLUDE_ROARING_VERSION
#define ROARING_INCLUDE_ROARING_VERSION
#define ROARING_VERSION "4.1.1"
#define ROARING_VERSION "4.1.2"
enum {
ROARING_VERSION_MAJOR = 4,
ROARING_VERSION_MINOR = 1,
ROARING_VERSION_REVISION = 1
ROARING_VERSION_REVISION = 2
};
#endif // ROARING_INCLUDE_ROARING_VERSION
// clang-format on/* end file include/roaring/roaring_version.h */
Expand Down Expand Up @@ -655,6 +655,8 @@ static inline uint32_t croaring_refcount_get(const croaring_refcount_t *val) {

#if defined(__GNUC__) || defined(__clang__)
#define CROARING_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define CROARING_DEPRECATED __declspec(deprecated)
#else
#define CROARING_DEPRECATED
#endif // defined(__GNUC__) || defined(__clang__)
Expand Down Expand Up @@ -2260,12 +2262,12 @@ using namespace ::roaring::api;
#ifndef INCLUDE_ROARING_MEMORY_H_
#define INCLUDE_ROARING_MEMORY_H_

#include <stddef.h> // for size_t

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h> // for size_t

typedef void* (*roaring_malloc_p)(size_t);
typedef void* (*roaring_realloc_p)(void*, size_t);
typedef void* (*roaring_calloc_p)(size_t, size_t);
Expand Down Expand Up @@ -2389,6 +2391,14 @@ roaring64_bitmap_t *roaring64_bitmap_of_ptr(size_t n_args,
&((const uint64_t[]){0, __VA_ARGS__})[1])
#endif

/**
* Create a new bitmap by moving containers from a 32 bit roaring bitmap.
*
* After calling this function, the original bitmap will be empty, and the
* returned bitmap will contain all the values from the original bitmap.
*/
roaring64_bitmap_t *roaring64_bitmap_move_from_roaring32(roaring_bitmap_t *r);

/**
* Create a new bitmap containing all the values in [min, max) that are at a
* distance k*step from min.
Expand Down
2 changes: 1 addition & 1 deletion croaring-sys/CRoaring/roaring.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
// Created by amalgamation.sh on 2024-07-30T19:32:00Z
// Created by amalgamation.sh on 2024-09-04T03:07:22Z

/*
* The CRoaring project is under a dual license (Apache/MIT).
Expand Down
2 changes: 1 addition & 1 deletion croaring-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "croaring-sys"
version = "4.1.1"
version = "4.1.2"
edition = "2021"
authors = ["croaring-rs developers"]
license = "Apache-2.0"
Expand Down

0 comments on commit d0730a3

Please sign in to comment.