Update roaring bitmap code
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
#include "ndpi_encryption.h"
|
||||
|
||||
#include "third_party/include/roaring.h"
|
||||
#include "third_party/src/roaring.cc"
|
||||
|
||||
/* ******************************************* */
|
||||
|
||||
|
||||
+279
-100
@@ -1,8 +1,12 @@
|
||||
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
|
||||
// Created by amalgamation.sh on Mer 25 Ago 2021 04:24:41 CEST
|
||||
// Created by amalgamation.sh on 2023-02-12T11:34:02Z
|
||||
|
||||
/*
|
||||
* Copyright 2016-2020 The CRoaring authors
|
||||
* The CRoaring project is under a dual license (Apache/MIT).
|
||||
* Users of the library may choose one or the other license.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2016-2022 The CRoaring authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,16 +22,47 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2016-2022 The CRoaring authors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any
|
||||
* person obtaining a copy of this software and associated
|
||||
* documentation files (the "Software"), to deal in the
|
||||
* Software without restriction, including without
|
||||
* limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software
|
||||
* is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice
|
||||
* shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* begin file include/roaring/roaring_version.h */
|
||||
// /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 = 0.3.4,
|
||||
#define ROARING_VERSION "0.9.6"
|
||||
enum {
|
||||
ROARING_VERSION_MAJOR = 0,
|
||||
ROARING_VERSION_MINOR = 3,
|
||||
ROARING_VERSION_REVISION = 4
|
||||
ROARING_VERSION_MINOR = 9,
|
||||
ROARING_VERSION_REVISION = 6
|
||||
};
|
||||
#endif // ROARING_INCLUDE_ROARING_VERSION
|
||||
/* end file include/roaring/roaring_version.h */
|
||||
@@ -68,12 +103,6 @@ extern "C" { namespace roaring { namespace api {
|
||||
#define ROARING_CONTAINER_T void // no compile-time checking
|
||||
#endif
|
||||
|
||||
|
||||
#define MAX_CONTAINERS 65536
|
||||
|
||||
#define SERIALIZATION_ARRAY_UINT32 1
|
||||
#define SERIALIZATION_CONTAINER 2
|
||||
|
||||
#define ROARING_FLAG_COW UINT8_C(0x1)
|
||||
#define ROARING_FLAG_FROZEN UINT8_C(0x2)
|
||||
|
||||
@@ -170,7 +199,7 @@ typedef struct roaring_bitmap_s {
|
||||
* Capacity is a performance hint for how many "containers" the data will need.
|
||||
* Client is responsible for calling `roaring_bitmap_free()`.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_create_with_capacity(uint32_t cap);
|
||||
roaring_bitmap_t *roaring_bitmap_create_with_capacity(uint32_t cap);
|
||||
|
||||
/**
|
||||
* Dynamically allocates a new bitmap (initially empty).
|
||||
@@ -185,7 +214,7 @@ static inline roaring_bitmap_t *roaring_bitmap_create(void)
|
||||
* Capacity is a performance hint for how many "containers" the data will need.
|
||||
* Can return false if auxiliary allocations fail when capacity greater than 0.
|
||||
*/
|
||||
static bool roaring_bitmap_init_with_capacity(roaring_bitmap_t *r, uint32_t cap);
|
||||
bool roaring_bitmap_init_with_capacity(roaring_bitmap_t *r, uint32_t cap);
|
||||
|
||||
/**
|
||||
* Initialize a roaring bitmap structure in memory controlled by client.
|
||||
@@ -199,13 +228,13 @@ static inline void roaring_bitmap_init_cleared(roaring_bitmap_t *r)
|
||||
* Add all the values between min (included) and max (excluded) that are at a
|
||||
* distance k*step from min.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_from_range(uint64_t min, uint64_t max,
|
||||
roaring_bitmap_t *roaring_bitmap_from_range(uint64_t min, uint64_t max,
|
||||
uint32_t step);
|
||||
|
||||
/**
|
||||
* Creates a new bitmap from a pointer of uint32_t integers
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_of_ptr(size_t n_args, const uint32_t *vals);
|
||||
roaring_bitmap_t *roaring_bitmap_of_ptr(size_t n_args, const uint32_t *vals);
|
||||
|
||||
/*
|
||||
* Whether you want to use copy-on-write.
|
||||
@@ -228,21 +257,23 @@ static inline void roaring_bitmap_set_copy_on_write(roaring_bitmap_t* r,
|
||||
}
|
||||
}
|
||||
|
||||
roaring_bitmap_t *roaring_bitmap_add_offset(const roaring_bitmap_t *bm,
|
||||
int64_t offset);
|
||||
/**
|
||||
* Describe the inner structure of the bitmap.
|
||||
*/
|
||||
static void roaring_bitmap_printf_describe(const roaring_bitmap_t *r);
|
||||
void roaring_bitmap_printf_describe(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Creates a new bitmap from a list of uint32_t integers
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_of(size_t n, ...);
|
||||
roaring_bitmap_t *roaring_bitmap_of(size_t n, ...);
|
||||
|
||||
/**
|
||||
* Copies a bitmap (this does memory allocation).
|
||||
* The caller is responsible for memory management.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_copy(const roaring_bitmap_t *r);
|
||||
roaring_bitmap_t *roaring_bitmap_copy(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Copies a bitmap from src to dest. It is assumed that the pointer dest
|
||||
@@ -252,37 +283,42 @@ static roaring_bitmap_t *roaring_bitmap_copy(const roaring_bitmap_t *r);
|
||||
* It might be preferable and simpler to call roaring_bitmap_copy except
|
||||
* that roaring_bitmap_overwrite can save on memory allocations.
|
||||
*/
|
||||
static bool roaring_bitmap_overwrite(roaring_bitmap_t *dest,
|
||||
bool roaring_bitmap_overwrite(roaring_bitmap_t *dest,
|
||||
const roaring_bitmap_t *src);
|
||||
|
||||
/**
|
||||
* Print the content of the bitmap.
|
||||
*/
|
||||
static void roaring_bitmap_printf(const roaring_bitmap_t *r);
|
||||
void roaring_bitmap_printf(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Computes the intersection between two bitmaps and returns new bitmap. The
|
||||
* caller is responsible for memory management.
|
||||
*
|
||||
* Performance hint: if you are computing the intersection between several
|
||||
* bitmaps, two-by-two, it is best to start with the smallest bitmap.
|
||||
* You may also rely on roaring_bitmap_and_inplace to avoid creating
|
||||
* many temporary bitmaps.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_and(const roaring_bitmap_t *r1,
|
||||
roaring_bitmap_t *roaring_bitmap_and(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Computes the size of the intersection between two bitmaps.
|
||||
*/
|
||||
static uint64_t roaring_bitmap_and_cardinality(const roaring_bitmap_t *r1,
|
||||
uint64_t roaring_bitmap_and_cardinality(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Check whether two bitmaps intersect.
|
||||
*/
|
||||
static bool roaring_bitmap_intersect(const roaring_bitmap_t *r1,
|
||||
bool roaring_bitmap_intersect(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Check whether a bitmap and a closed range intersect.
|
||||
*/
|
||||
static bool roaring_bitmap_intersect_with_range(const roaring_bitmap_t *bm,
|
||||
bool roaring_bitmap_intersect_with_range(const roaring_bitmap_t *bm,
|
||||
uint64_t x, uint64_t y);
|
||||
|
||||
/**
|
||||
@@ -291,46 +327,49 @@ static bool roaring_bitmap_intersect_with_range(const roaring_bitmap_t *bm,
|
||||
*
|
||||
* The Jaccard index is undefined if both bitmaps are empty.
|
||||
*/
|
||||
static double roaring_bitmap_jaccard_index(const roaring_bitmap_t *r1,
|
||||
double roaring_bitmap_jaccard_index(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Computes the size of the union between two bitmaps.
|
||||
*/
|
||||
static uint64_t roaring_bitmap_or_cardinality(const roaring_bitmap_t *r1,
|
||||
uint64_t roaring_bitmap_or_cardinality(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Computes the size of the difference (andnot) between two bitmaps.
|
||||
*/
|
||||
static uint64_t roaring_bitmap_andnot_cardinality(const roaring_bitmap_t *r1,
|
||||
uint64_t roaring_bitmap_andnot_cardinality(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Computes the size of the symmetric difference (xor) between two bitmaps.
|
||||
*/
|
||||
static uint64_t roaring_bitmap_xor_cardinality(const roaring_bitmap_t *r1,
|
||||
uint64_t roaring_bitmap_xor_cardinality(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Inplace version of `roaring_bitmap_and()`, modifies r1
|
||||
* r1 == r2 is allowed
|
||||
* r1 == r2 is allowed.
|
||||
*
|
||||
* Performance hint: if you are computing the intersection between several
|
||||
* bitmaps, two-by-two, it is best to start with the smallest bitmap.
|
||||
*/
|
||||
static void roaring_bitmap_and_inplace(roaring_bitmap_t *r1,
|
||||
void roaring_bitmap_and_inplace(roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Computes the union between two bitmaps and returns new bitmap. The caller is
|
||||
* responsible for memory management.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_or(const roaring_bitmap_t *r1,
|
||||
roaring_bitmap_t *roaring_bitmap_or(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Inplace version of `roaring_bitmap_or(), modifies r1.
|
||||
* TODO: decide whether r1 == r2 ok
|
||||
*/
|
||||
static void roaring_bitmap_or_inplace(roaring_bitmap_t *r1,
|
||||
void roaring_bitmap_or_inplace(roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
@@ -338,7 +377,7 @@ static void roaring_bitmap_or_inplace(roaring_bitmap_t *r1,
|
||||
* Caller is responsible for freeing the result.
|
||||
* See also `roaring_bitmap_or_many_heap()`
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_or_many(size_t number,
|
||||
roaring_bitmap_t *roaring_bitmap_or_many(size_t number,
|
||||
const roaring_bitmap_t **rs);
|
||||
|
||||
/**
|
||||
@@ -346,40 +385,40 @@ static roaring_bitmap_t *roaring_bitmap_or_many(size_t number,
|
||||
* faster than `roaring_bitmap_or_many() which uses a naive algorithm.
|
||||
* Caller is responsible for freeing the result.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_or_many_heap(uint32_t number,
|
||||
roaring_bitmap_t *roaring_bitmap_or_many_heap(uint32_t number,
|
||||
const roaring_bitmap_t **rs);
|
||||
|
||||
/**
|
||||
* Computes the symmetric difference (xor) between two bitmaps
|
||||
* and returns new bitmap. The caller is responsible for memory management.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_xor(const roaring_bitmap_t *r1,
|
||||
roaring_bitmap_t *roaring_bitmap_xor(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Inplace version of roaring_bitmap_xor, modifies r1, r1 != r2.
|
||||
*/
|
||||
static void roaring_bitmap_xor_inplace(roaring_bitmap_t *r1,
|
||||
void roaring_bitmap_xor_inplace(roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Compute the xor of 'number' bitmaps.
|
||||
* Caller is responsible for freeing the result.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_xor_many(size_t number,
|
||||
roaring_bitmap_t *roaring_bitmap_xor_many(size_t number,
|
||||
const roaring_bitmap_t **rs);
|
||||
|
||||
/**
|
||||
* Computes the difference (andnot) between two bitmaps and returns new bitmap.
|
||||
* Caller is responsible for freeing the result.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_andnot(const roaring_bitmap_t *r1,
|
||||
roaring_bitmap_t *roaring_bitmap_andnot(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Inplace version of roaring_bitmap_andnot, modifies r1, r1 != r2.
|
||||
*/
|
||||
static void roaring_bitmap_andnot_inplace(roaring_bitmap_t *r1,
|
||||
void roaring_bitmap_andnot_inplace(roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
@@ -396,30 +435,69 @@ static void roaring_bitmap_andnot_inplace(roaring_bitmap_t *r1,
|
||||
/**
|
||||
* Frees the memory.
|
||||
*/
|
||||
static void roaring_bitmap_free(const roaring_bitmap_t *r);
|
||||
void roaring_bitmap_free(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* A bit of context usable with `roaring_bitmap_*_bulk()` functions
|
||||
*
|
||||
* Should be initialized with `{0}` (or `memset()` to all zeros).
|
||||
* Callers should treat it as an opaque type.
|
||||
*
|
||||
* A context may only be used with a single bitmap
|
||||
* (unless re-initialized to zero), and any modification to a bitmap
|
||||
* (other than modifications performed with `_bulk()` functions with the context
|
||||
* passed) will invalidate any contexts associated with that bitmap.
|
||||
*/
|
||||
typedef struct roaring_bulk_context_s {
|
||||
ROARING_CONTAINER_T *container;
|
||||
int idx;
|
||||
uint16_t key;
|
||||
uint8_t typecode;
|
||||
} roaring_bulk_context_t;
|
||||
|
||||
/**
|
||||
* Add an item, using context from a previous insert for speed optimization.
|
||||
*
|
||||
* `context` will be used to store information between calls to make bulk
|
||||
* operations faster. `*context` should be zero-initialized before the first
|
||||
* call to this function.
|
||||
*
|
||||
* Modifying the bitmap in any way (other than `-bulk` suffixed functions)
|
||||
* will invalidate the stored context, calling this function with a non-zero
|
||||
* context after doing any modification invokes undefined behavior.
|
||||
*
|
||||
* In order to exploit this optimization, the caller should call this function
|
||||
* with values with the same "key" (high 16 bits of the value) consecutively.
|
||||
*/
|
||||
void roaring_bitmap_add_bulk(roaring_bitmap_t *r,
|
||||
roaring_bulk_context_t *context, uint32_t val);
|
||||
|
||||
/**
|
||||
* Add value n_args from pointer vals, faster than repeatedly calling
|
||||
* `roaring_bitmap_add()`
|
||||
*
|
||||
* In order to exploit this optimization, the caller should attempt to keep
|
||||
* values with the same "key" (high 16 bits of the value) as consecutive
|
||||
* elements in `vals`
|
||||
*/
|
||||
static void roaring_bitmap_add_many(roaring_bitmap_t *r, size_t n_args,
|
||||
void roaring_bitmap_add_many(roaring_bitmap_t *r, size_t n_args,
|
||||
const uint32_t *vals);
|
||||
|
||||
/**
|
||||
* Add value x
|
||||
*/
|
||||
static void roaring_bitmap_add(roaring_bitmap_t *r, uint32_t x);
|
||||
void roaring_bitmap_add(roaring_bitmap_t *r, uint32_t x);
|
||||
|
||||
/**
|
||||
* Add value x
|
||||
* Returns true if a new value was added, false if the value already existed.
|
||||
*/
|
||||
static bool roaring_bitmap_add_checked(roaring_bitmap_t *r, uint32_t x);
|
||||
bool roaring_bitmap_add_checked(roaring_bitmap_t *r, uint32_t x);
|
||||
|
||||
/**
|
||||
* Add all values in range [min, max]
|
||||
*/
|
||||
static void roaring_bitmap_add_range_closed(roaring_bitmap_t *r,
|
||||
void roaring_bitmap_add_range_closed(roaring_bitmap_t *r,
|
||||
uint32_t min, uint32_t max);
|
||||
|
||||
/**
|
||||
@@ -434,12 +512,12 @@ static inline void roaring_bitmap_add_range(roaring_bitmap_t *r,
|
||||
/**
|
||||
* Remove value x
|
||||
*/
|
||||
static void roaring_bitmap_remove(roaring_bitmap_t *r, uint32_t x);
|
||||
void roaring_bitmap_remove(roaring_bitmap_t *r, uint32_t x);
|
||||
|
||||
/**
|
||||
* Remove all values in range [min, max]
|
||||
*/
|
||||
static void roaring_bitmap_remove_range_closed(roaring_bitmap_t *r,
|
||||
void roaring_bitmap_remove_range_closed(roaring_bitmap_t *r,
|
||||
uint32_t min, uint32_t max);
|
||||
|
||||
/**
|
||||
@@ -454,44 +532,63 @@ static inline void roaring_bitmap_remove_range(roaring_bitmap_t *r,
|
||||
/**
|
||||
* Remove multiple values
|
||||
*/
|
||||
static void roaring_bitmap_remove_many(roaring_bitmap_t *r, size_t n_args,
|
||||
void roaring_bitmap_remove_many(roaring_bitmap_t *r, size_t n_args,
|
||||
const uint32_t *vals);
|
||||
|
||||
/**
|
||||
* Remove value x
|
||||
* Returns true if a new value was removed, false if the value was not existing.
|
||||
*/
|
||||
static bool roaring_bitmap_remove_checked(roaring_bitmap_t *r, uint32_t x);
|
||||
bool roaring_bitmap_remove_checked(roaring_bitmap_t *r, uint32_t x);
|
||||
|
||||
/**
|
||||
* Check if value is present
|
||||
*/
|
||||
static bool roaring_bitmap_contains(const roaring_bitmap_t *r, uint32_t val);
|
||||
bool roaring_bitmap_contains(const roaring_bitmap_t *r, uint32_t val);
|
||||
|
||||
/**
|
||||
* Check whether a range of values from range_start (included)
|
||||
* to range_end (excluded) is present
|
||||
*/
|
||||
static bool roaring_bitmap_contains_range(const roaring_bitmap_t *r,
|
||||
bool roaring_bitmap_contains_range(const roaring_bitmap_t *r,
|
||||
uint64_t range_start,
|
||||
uint64_t range_end);
|
||||
|
||||
/**
|
||||
* Check if an items is present, using context from a previous insert for speed
|
||||
* optimization.
|
||||
*
|
||||
* `context` will be used to store information between calls to make bulk
|
||||
* operations faster. `*context` should be zero-initialized before the first
|
||||
* call to this function.
|
||||
*
|
||||
* Modifying the bitmap in any way (other than `-bulk` suffixed functions)
|
||||
* will invalidate the stored context, calling this function with a non-zero
|
||||
* context after doing any modification invokes undefined behavior.
|
||||
*
|
||||
* In order to exploit this optimization, the caller should call this function
|
||||
* with values with the same "key" (high 16 bits of the value) consecutively.
|
||||
*/
|
||||
bool roaring_bitmap_contains_bulk(const roaring_bitmap_t *r,
|
||||
roaring_bulk_context_t *context,
|
||||
uint32_t val);
|
||||
|
||||
/**
|
||||
* Get the cardinality of the bitmap (number of elements).
|
||||
*/
|
||||
static uint64_t roaring_bitmap_get_cardinality(const roaring_bitmap_t *r);
|
||||
uint64_t roaring_bitmap_get_cardinality(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the range [range_start, range_end).
|
||||
*/
|
||||
static uint64_t roaring_bitmap_range_cardinality(const roaring_bitmap_t *r,
|
||||
uint64_t roaring_bitmap_range_cardinality(const roaring_bitmap_t *r,
|
||||
uint64_t range_start,
|
||||
uint64_t range_end);
|
||||
|
||||
/**
|
||||
* Returns true if the bitmap is empty (cardinality is zero).
|
||||
*/
|
||||
static bool roaring_bitmap_is_empty(const roaring_bitmap_t *r);
|
||||
bool roaring_bitmap_is_empty(const roaring_bitmap_t *r);
|
||||
|
||||
|
||||
/**
|
||||
@@ -499,20 +596,20 @@ static bool roaring_bitmap_is_empty(const roaring_bitmap_t *r);
|
||||
* was initialized in client memory via roaring_bitmap_init(), then a call to
|
||||
* roaring_bitmap_clear() would be enough to "free" it)
|
||||
*/
|
||||
static void roaring_bitmap_clear(roaring_bitmap_t *r);
|
||||
void roaring_bitmap_clear(roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Convert the bitmap to an array, output in `ans`,
|
||||
* Convert the bitmap to a sorted array, output in `ans`.
|
||||
*
|
||||
* Caller is responsible to ensure that there is enough memory allocated, e.g.
|
||||
*
|
||||
* ans = malloc(roaring_bitmap_get_cardinality(bitmap) * sizeof(uint32_t));
|
||||
*/
|
||||
static void roaring_bitmap_to_uint32_array(const roaring_bitmap_t *r, uint32_t *ans);
|
||||
void roaring_bitmap_to_uint32_array(const roaring_bitmap_t *r, uint32_t *ans);
|
||||
|
||||
|
||||
/**
|
||||
* Convert the bitmap to an array from `offset` by `limit`, output in `ans`.
|
||||
* Convert the bitmap to a sorted array from `offset` by `limit`, output in `ans`.
|
||||
*
|
||||
* Caller is responsible to ensure that there is enough memory allocated, e.g.
|
||||
*
|
||||
@@ -520,7 +617,7 @@ static void roaring_bitmap_to_uint32_array(const roaring_bitmap_t *r, uint32_t *
|
||||
*
|
||||
* Return false in case of failure (e.g., insufficient memory)
|
||||
*/
|
||||
static bool roaring_bitmap_range_uint32_array(const roaring_bitmap_t *r,
|
||||
bool roaring_bitmap_range_uint32_array(const roaring_bitmap_t *r,
|
||||
size_t offset, size_t limit,
|
||||
uint32_t *ans);
|
||||
|
||||
@@ -528,7 +625,7 @@ static bool roaring_bitmap_range_uint32_array(const roaring_bitmap_t *r,
|
||||
* Remove run-length encoding even when it is more space efficient.
|
||||
* Return whether a change was applied.
|
||||
*/
|
||||
static bool roaring_bitmap_remove_run_compression(roaring_bitmap_t *r);
|
||||
bool roaring_bitmap_remove_run_compression(roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Convert array and bitmap containers to run containers when it is more
|
||||
@@ -537,13 +634,13 @@ static bool roaring_bitmap_remove_run_compression(roaring_bitmap_t *r);
|
||||
* Returns true if the result has at least one run container.
|
||||
* Additional savings might be possible by calling `shrinkToFit()`.
|
||||
*/
|
||||
static bool roaring_bitmap_run_optimize(roaring_bitmap_t *r);
|
||||
bool roaring_bitmap_run_optimize(roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* If needed, reallocate memory to shrink the memory usage.
|
||||
* Returns the number of bytes saved.
|
||||
*/
|
||||
static size_t roaring_bitmap_shrink_to_fit(roaring_bitmap_t *r);
|
||||
size_t roaring_bitmap_shrink_to_fit(roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Write the bitmap to an output pointer, this output buffer should refer to
|
||||
@@ -554,22 +651,28 @@ static size_t roaring_bitmap_shrink_to_fit(roaring_bitmap_t *r);
|
||||
* more space efficient than the portable form, e.g. when the data is sparse.
|
||||
*
|
||||
* Returns how many bytes written, should be `roaring_bitmap_size_in_bytes(r)`.
|
||||
*
|
||||
* This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),
|
||||
* the data format is going to be big-endian and not compatible with little-endian systems.
|
||||
*/
|
||||
static size_t roaring_bitmap_serialize(const roaring_bitmap_t *r, char *buf);
|
||||
size_t roaring_bitmap_serialize(const roaring_bitmap_t *r, char *buf);
|
||||
|
||||
/**
|
||||
* Use with `roaring_bitmap_serialize()`.
|
||||
*
|
||||
* (See `roaring_bitmap_portable_deserialize()` if you want a format that's
|
||||
* compatible with Java and Go implementations)
|
||||
* compatible with Java and Go implementations).
|
||||
*
|
||||
* This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),
|
||||
* the data format is going to be big-endian and not compatible with little-endian systems.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_deserialize(const void *buf);
|
||||
roaring_bitmap_t *roaring_bitmap_deserialize(const void *buf);
|
||||
|
||||
/**
|
||||
* How many bytes are required to serialize this bitmap (NOT compatible
|
||||
* with Java and Go versions)
|
||||
*/
|
||||
static size_t roaring_bitmap_size_in_bytes(const roaring_bitmap_t *r);
|
||||
size_t roaring_bitmap_size_in_bytes(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Read bitmap from a serialized buffer.
|
||||
@@ -581,8 +684,11 @@ static size_t roaring_bitmap_size_in_bytes(const roaring_bitmap_t *r);
|
||||
*
|
||||
* This is meant to be compatible with the Java and Go versions:
|
||||
* https://github.com/RoaringBitmap/RoaringFormatSpec
|
||||
*
|
||||
* This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),
|
||||
* the data format is going to be big-endian and not compatible with little-endian systems.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_portable_deserialize(const char *buf);
|
||||
roaring_bitmap_t *roaring_bitmap_portable_deserialize(const char *buf);
|
||||
|
||||
/**
|
||||
* Read bitmap from a serialized buffer safely (reading up to maxbytes).
|
||||
@@ -590,10 +696,34 @@ static roaring_bitmap_t *roaring_bitmap_portable_deserialize(const char *buf);
|
||||
*
|
||||
* This is meant to be compatible with the Java and Go versions:
|
||||
* https://github.com/RoaringBitmap/RoaringFormatSpec
|
||||
*
|
||||
* This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),
|
||||
* the data format is going to be big-endian and not compatible with little-endian systems.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_portable_deserialize_safe(const char *buf,
|
||||
roaring_bitmap_t *roaring_bitmap_portable_deserialize_safe(const char *buf,
|
||||
size_t maxbytes);
|
||||
|
||||
/**
|
||||
* Read bitmap from a serialized buffer.
|
||||
* In case of failure, NULL is returned.
|
||||
*
|
||||
* Bitmap returned by this function can be used in all readonly contexts.
|
||||
* Bitmap must be freed as usual, by calling roaring_bitmap_free().
|
||||
* Underlying buffer must not be freed or modified while it backs any bitmaps.
|
||||
*
|
||||
* The function is unsafe in the following ways:
|
||||
* 1) It may execute unaligned memory accesses.
|
||||
* 2) A buffer overflow may occur if buf does not point to a valid serialized
|
||||
* bitmap.
|
||||
*
|
||||
* This is meant to be compatible with the Java and Go versions:
|
||||
* https://github.com/RoaringBitmap/RoaringFormatSpec
|
||||
*
|
||||
* This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),
|
||||
* the data format is going to be big-endian and not compatible with little-endian systems.
|
||||
*/
|
||||
roaring_bitmap_t *roaring_bitmap_portable_deserialize_frozen(const char *buf);
|
||||
|
||||
/**
|
||||
* Check how many bytes would be read (up to maxbytes) at this pointer if there
|
||||
* is a bitmap, returns zero if there is no valid bitmap.
|
||||
@@ -601,7 +731,7 @@ static roaring_bitmap_t *roaring_bitmap_portable_deserialize_safe(const char *bu
|
||||
* This is meant to be compatible with the Java and Go versions:
|
||||
* https://github.com/RoaringBitmap/RoaringFormatSpec
|
||||
*/
|
||||
static size_t roaring_bitmap_portable_deserialize_size(const char *buf,
|
||||
size_t roaring_bitmap_portable_deserialize_size(const char *buf,
|
||||
size_t maxbytes);
|
||||
|
||||
/**
|
||||
@@ -610,7 +740,7 @@ static size_t roaring_bitmap_portable_deserialize_size(const char *buf,
|
||||
* This is meant to be compatible with the Java and Go versions:
|
||||
* https://github.com/RoaringBitmap/RoaringFormatSpec
|
||||
*/
|
||||
static size_t roaring_bitmap_portable_size_in_bytes(const roaring_bitmap_t *r);
|
||||
size_t roaring_bitmap_portable_size_in_bytes(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Write a bitmap to a char buffer. The output buffer should refer to at least
|
||||
@@ -621,8 +751,11 @@ static size_t roaring_bitmap_portable_size_in_bytes(const roaring_bitmap_t *r);
|
||||
*
|
||||
* This is meant to be compatible with the Java and Go versions:
|
||||
* https://github.com/RoaringBitmap/RoaringFormatSpec
|
||||
*
|
||||
* This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),
|
||||
* the data format is going to be big-endian and not compatible with little-endian systems.
|
||||
*/
|
||||
static size_t roaring_bitmap_portable_serialize(const roaring_bitmap_t *r, char *buf);
|
||||
size_t roaring_bitmap_portable_serialize(const roaring_bitmap_t *r, char *buf);
|
||||
|
||||
/*
|
||||
* "Frozen" serialization format imitates memory layout of roaring_bitmap_t.
|
||||
@@ -646,13 +779,16 @@ static size_t roaring_bitmap_portable_serialize(const roaring_bitmap_t *r, char
|
||||
/**
|
||||
* Returns number of bytes required to serialize bitmap using frozen format.
|
||||
*/
|
||||
static size_t roaring_bitmap_frozen_size_in_bytes(const roaring_bitmap_t *r);
|
||||
size_t roaring_bitmap_frozen_size_in_bytes(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Serializes bitmap using frozen format.
|
||||
* Buffer size must be at least roaring_bitmap_frozen_size_in_bytes().
|
||||
*
|
||||
* This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),
|
||||
* the data format is going to be big-endian and not compatible with little-endian systems.
|
||||
*/
|
||||
static void roaring_bitmap_frozen_serialize(const roaring_bitmap_t *r, char *buf);
|
||||
void roaring_bitmap_frozen_serialize(const roaring_bitmap_t *r, char *buf);
|
||||
|
||||
/**
|
||||
* Creates constant bitmap that is a view of a given buffer.
|
||||
@@ -664,8 +800,11 @@ static void roaring_bitmap_frozen_serialize(const roaring_bitmap_t *r, char *buf
|
||||
* Bitmap returned by this function can be used in all readonly contexts.
|
||||
* Bitmap must be freed as usual, by calling roaring_bitmap_free().
|
||||
* Underlying buffer must not be freed or modified while it backs any bitmaps.
|
||||
*
|
||||
* This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x),
|
||||
* the data format is going to be big-endian and not compatible with little-endian systems.
|
||||
*/
|
||||
static const roaring_bitmap_t *roaring_bitmap_frozen_view(const char *buf,
|
||||
const roaring_bitmap_t *roaring_bitmap_frozen_view(const char *buf,
|
||||
size_t length);
|
||||
|
||||
/**
|
||||
@@ -681,29 +820,29 @@ static const roaring_bitmap_t *roaring_bitmap_frozen_view(const char *buf,
|
||||
*
|
||||
* Iteration is ordered: from the smallest to the largest elements.
|
||||
*/
|
||||
static bool roaring_iterate(const roaring_bitmap_t *r, roaring_iterator iterator,
|
||||
bool roaring_iterate(const roaring_bitmap_t *r, roaring_iterator iterator,
|
||||
void *ptr);
|
||||
|
||||
static bool roaring_iterate64(const roaring_bitmap_t *r, roaring_iterator64 iterator,
|
||||
bool roaring_iterate64(const roaring_bitmap_t *r, roaring_iterator64 iterator,
|
||||
uint64_t high_bits, void *ptr);
|
||||
|
||||
/**
|
||||
* Return true if the two bitmaps contain the same elements.
|
||||
*/
|
||||
static bool roaring_bitmap_equals(const roaring_bitmap_t *r1,
|
||||
bool roaring_bitmap_equals(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Return true if all the elements of r1 are also in r2.
|
||||
*/
|
||||
static bool roaring_bitmap_is_subset(const roaring_bitmap_t *r1,
|
||||
bool roaring_bitmap_is_subset(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
* Return true if all the elements of r1 are also in r2, and r2 is strictly
|
||||
* greater than r1.
|
||||
*/
|
||||
static bool roaring_bitmap_is_strict_subset(const roaring_bitmap_t *r1,
|
||||
bool roaring_bitmap_is_strict_subset(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
@@ -721,7 +860,7 @@ static bool roaring_bitmap_is_strict_subset(const roaring_bitmap_t *r1,
|
||||
* `bitsetconversion` is a flag which determines whether container-container
|
||||
* operations force a bitset conversion.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_lazy_or(const roaring_bitmap_t *r1,
|
||||
roaring_bitmap_t *roaring_bitmap_lazy_or(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2,
|
||||
const bool bitsetconversion);
|
||||
|
||||
@@ -733,7 +872,7 @@ static roaring_bitmap_t *roaring_bitmap_lazy_or(const roaring_bitmap_t *r1,
|
||||
* `bitsetconversion` is a flag which determines whether container-container
|
||||
* operations force a bitset conversion.
|
||||
*/
|
||||
static void roaring_bitmap_lazy_or_inplace(roaring_bitmap_t *r1,
|
||||
void roaring_bitmap_lazy_or_inplace(roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2,
|
||||
const bool bitsetconversion);
|
||||
|
||||
@@ -743,7 +882,7 @@ static void roaring_bitmap_lazy_or_inplace(roaring_bitmap_t *r1,
|
||||
* Execute maintenance on a bitmap created from `roaring_bitmap_lazy_or()`
|
||||
* or modified with `roaring_bitmap_lazy_or_inplace()`.
|
||||
*/
|
||||
static void roaring_bitmap_repair_after_lazy(roaring_bitmap_t *r1);
|
||||
void roaring_bitmap_repair_after_lazy(roaring_bitmap_t *r1);
|
||||
|
||||
/**
|
||||
* Computes the symmetric difference between two bitmaps and returns new bitmap.
|
||||
@@ -756,7 +895,7 @@ static void roaring_bitmap_repair_after_lazy(roaring_bitmap_t *r1);
|
||||
* It is safe to repeatedly call `roaring_bitmap_lazy_xor_inplace()` on
|
||||
* the result.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_lazy_xor(const roaring_bitmap_t *r1,
|
||||
roaring_bitmap_t *roaring_bitmap_lazy_xor(const roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
@@ -764,7 +903,7 @@ static roaring_bitmap_t *roaring_bitmap_lazy_xor(const roaring_bitmap_t *r1,
|
||||
*
|
||||
* Inplace version of roaring_bitmap_lazy_xor, modifies r1. r1 != r2
|
||||
*/
|
||||
static void roaring_bitmap_lazy_xor_inplace(roaring_bitmap_t *r1,
|
||||
void roaring_bitmap_lazy_xor_inplace(roaring_bitmap_t *r1,
|
||||
const roaring_bitmap_t *r2);
|
||||
|
||||
/**
|
||||
@@ -772,7 +911,7 @@ static void roaring_bitmap_lazy_xor_inplace(roaring_bitmap_t *r1,
|
||||
* The number of negated values is range_end - range_start.
|
||||
* Areas outside the range are passed through unchanged.
|
||||
*/
|
||||
static roaring_bitmap_t *roaring_bitmap_flip(const roaring_bitmap_t *r1,
|
||||
roaring_bitmap_t *roaring_bitmap_flip(const roaring_bitmap_t *r1,
|
||||
uint64_t range_start, uint64_t range_end);
|
||||
|
||||
/**
|
||||
@@ -781,7 +920,7 @@ static roaring_bitmap_t *roaring_bitmap_flip(const roaring_bitmap_t *r1,
|
||||
* range_end - range_start.
|
||||
* Areas outside the range are passed through unchanged.
|
||||
*/
|
||||
static void roaring_bitmap_flip_inplace(roaring_bitmap_t *r1, uint64_t range_start,
|
||||
void roaring_bitmap_flip_inplace(roaring_bitmap_t *r1, uint64_t range_start,
|
||||
uint64_t range_end);
|
||||
|
||||
/**
|
||||
@@ -790,7 +929,7 @@ static void roaring_bitmap_flip_inplace(roaring_bitmap_t *r1, uint64_t range_sta
|
||||
* function returns true and sets element to the element of given rank.
|
||||
* Otherwise, it returns false.
|
||||
*/
|
||||
static bool roaring_bitmap_select(const roaring_bitmap_t *r, uint32_t rank,
|
||||
bool roaring_bitmap_select(const roaring_bitmap_t *r, uint32_t rank,
|
||||
uint32_t *element);
|
||||
|
||||
/**
|
||||
@@ -803,17 +942,17 @@ static bool roaring_bitmap_select(const roaring_bitmap_t *r, uint32_t rank,
|
||||
* as having index 0, whereas roaring_bitmap_rank returns 1 when ranking
|
||||
* the smallest value.
|
||||
*/
|
||||
static uint64_t roaring_bitmap_rank(const roaring_bitmap_t *r, uint32_t x);
|
||||
uint64_t roaring_bitmap_rank(const roaring_bitmap_t *r, uint32_t x);
|
||||
|
||||
/**
|
||||
* Returns the smallest value in the set, or UINT32_MAX if the set is empty.
|
||||
*/
|
||||
static uint32_t roaring_bitmap_minimum(const roaring_bitmap_t *r);
|
||||
uint32_t roaring_bitmap_minimum(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Returns the greatest value in the set, or 0 if the set is empty.
|
||||
*/
|
||||
static uint32_t roaring_bitmap_maximum(const roaring_bitmap_t *r);
|
||||
uint32_t roaring_bitmap_maximum(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* (For advanced users.)
|
||||
@@ -821,7 +960,7 @@ static uint32_t roaring_bitmap_maximum(const roaring_bitmap_t *r);
|
||||
* Collect statistics about the bitmap, see roaring_types.h for
|
||||
* a description of roaring_statistics_t
|
||||
*/
|
||||
static void roaring_bitmap_statistics(const roaring_bitmap_t *r,
|
||||
void roaring_bitmap_statistics(const roaring_bitmap_t *r,
|
||||
roaring_statistics_t *stat);
|
||||
|
||||
/*********************
|
||||
@@ -865,7 +1004,7 @@ typedef struct roaring_uint32_iterator_s {
|
||||
* values. If there is a value, then this iterator points to the first value
|
||||
* and `it->has_value` is true. The value is in `it->current_value`.
|
||||
*/
|
||||
static void roaring_init_iterator(const roaring_bitmap_t *r,
|
||||
void roaring_init_iterator(const roaring_bitmap_t *r,
|
||||
roaring_uint32_iterator_t *newit);
|
||||
|
||||
/**
|
||||
@@ -873,7 +1012,7 @@ static void roaring_init_iterator(const roaring_bitmap_t *r,
|
||||
* values. If there is a value, then this iterator points to the last value
|
||||
* and `it->has_value` is true. The value is in `it->current_value`.
|
||||
*/
|
||||
static void roaring_init_iterator_last(const roaring_bitmap_t *r,
|
||||
void roaring_init_iterator_last(const roaring_bitmap_t *r,
|
||||
roaring_uint32_iterator_t *newit);
|
||||
|
||||
/**
|
||||
@@ -884,41 +1023,41 @@ static void roaring_init_iterator_last(const roaring_bitmap_t *r,
|
||||
* If there is a value, then this iterator points to the first value and
|
||||
* `it->has_value` is true. The value is in `it->current_value`.
|
||||
*/
|
||||
static roaring_uint32_iterator_t *roaring_create_iterator(const roaring_bitmap_t *r);
|
||||
roaring_uint32_iterator_t *roaring_create_iterator(const roaring_bitmap_t *r);
|
||||
|
||||
/**
|
||||
* Advance the iterator. If there is a new value, then `it->has_value` is true.
|
||||
* The new value is in `it->current_value`. Values are traversed in increasing
|
||||
* orders. For convenience, returns `it->has_value`.
|
||||
*/
|
||||
static bool roaring_advance_uint32_iterator(roaring_uint32_iterator_t *it);
|
||||
bool roaring_advance_uint32_iterator(roaring_uint32_iterator_t *it);
|
||||
|
||||
/**
|
||||
* Decrement the iterator. If there's a new value, then `it->has_value` is true.
|
||||
* The new value is in `it->current_value`. Values are traversed in decreasing
|
||||
* order. For convenience, returns `it->has_value`.
|
||||
*/
|
||||
static bool roaring_previous_uint32_iterator(roaring_uint32_iterator_t *it);
|
||||
bool roaring_previous_uint32_iterator(roaring_uint32_iterator_t *it);
|
||||
|
||||
/**
|
||||
* Move the iterator to the first value >= `val`. If there is a such a value,
|
||||
* then `it->has_value` is true. The new value is in `it->current_value`.
|
||||
* For convenience, returns `it->has_value`.
|
||||
*/
|
||||
static bool roaring_move_uint32_iterator_equalorlarger(roaring_uint32_iterator_t *it,
|
||||
bool roaring_move_uint32_iterator_equalorlarger(roaring_uint32_iterator_t *it,
|
||||
uint32_t val);
|
||||
|
||||
/**
|
||||
* Creates a copy of an iterator.
|
||||
* Caller must free it.
|
||||
*/
|
||||
static roaring_uint32_iterator_t *roaring_copy_uint32_iterator(
|
||||
roaring_uint32_iterator_t *roaring_copy_uint32_iterator(
|
||||
const roaring_uint32_iterator_t *it);
|
||||
|
||||
/**
|
||||
* Free memory following `roaring_create_iterator()`
|
||||
*/
|
||||
static void roaring_free_uint32_iterator(roaring_uint32_iterator_t *it);
|
||||
void roaring_free_uint32_iterator(roaring_uint32_iterator_t *it);
|
||||
|
||||
/*
|
||||
* Reads next ${count} values from iterator into user-supplied ${buf}.
|
||||
@@ -930,7 +1069,7 @@ static void roaring_free_uint32_iterator(roaring_uint32_iterator_t *it);
|
||||
* - first value is copied from ${it}->current_value
|
||||
* - after function returns, iterator is positioned at the next element
|
||||
*/
|
||||
static uint32_t roaring_read_uint32_iterator(roaring_uint32_iterator_t *it,
|
||||
uint32_t roaring_read_uint32_iterator(roaring_uint32_iterator_t *it,
|
||||
uint32_t* buf, uint32_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -955,5 +1094,45 @@ static uint32_t roaring_read_uint32_iterator(roaring_uint32_iterator_t *it,
|
||||
using namespace ::roaring::api;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* end file include/roaring/roaring.h */
|
||||
/* begin file include/roaring/memory.h */
|
||||
#ifndef INCLUDE_ROARING_MEMORY_H_
|
||||
#define INCLUDE_ROARING_MEMORY_H_
|
||||
|
||||
#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);
|
||||
typedef void (*roaring_free_p)(void*);
|
||||
typedef void* (*roaring_aligned_malloc_p)(size_t, size_t);
|
||||
typedef void (*roaring_aligned_free_p)(void*);
|
||||
|
||||
typedef struct roaring_memory_s {
|
||||
roaring_malloc_p malloc;
|
||||
roaring_realloc_p realloc;
|
||||
roaring_calloc_p calloc;
|
||||
roaring_free_p free;
|
||||
roaring_aligned_malloc_p aligned_malloc;
|
||||
roaring_aligned_free_p aligned_free;
|
||||
} roaring_memory_t;
|
||||
|
||||
void roaring_init_memory_hook(roaring_memory_t memory_hook);
|
||||
|
||||
void* roaring_malloc(size_t);
|
||||
void* roaring_realloc(void*, size_t);
|
||||
void* roaring_calloc(size_t, size_t);
|
||||
void roaring_free(void*);
|
||||
void* roaring_aligned_malloc(size_t, size_t);
|
||||
void roaring_aligned_free(void*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // INCLUDE_ROARING_MEMORY_H_
|
||||
/* end file include/roaring/memory.h */
|
||||
|
||||
+10492
-10014
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user