1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/*
* mixed_intersection.h
*
*/
#ifndef INCLUDE_CONTAINERS_MIXED_INTERSECTION_H_
#define INCLUDE_CONTAINERS_MIXED_INTERSECTION_H_
/* These functions appear to exclude cases where the
* inputs have the same type and the output is guaranteed
* to have the same type as the inputs. Eg, array intersection
*/
#include <roaring/containers/array.h>
#include <roaring/containers/bitset.h>
#include <roaring/containers/run.h>
#ifdef __cplusplus
extern "C" { namespace roaring { namespace internal {
#endif
/* Compute the intersection of src_1 and src_2 and write the result to
* dst. It is allowed for dst to be equal to src_1. We assume that dst is a
* valid container. */
void array_bitset_container_intersection(const array_container_t *src_1,
const bitset_container_t *src_2,
array_container_t *dst);
/* Compute the size of the intersection of src_1 and src_2. */
int array_bitset_container_intersection_cardinality(
const array_container_t *src_1, const bitset_container_t *src_2);
/* Checking whether src_1 and src_2 intersect. */
bool array_bitset_container_intersect(const array_container_t *src_1,
const bitset_container_t *src_2);
/*
* Compute the intersection between src_1 and src_2 and write the result
* to *dst. If the return function is true, the result is a bitset_container_t
* otherwise is a array_container_t. We assume that dst is not pre-allocated. In
* case of failure, *dst will be NULL.
*/
bool bitset_bitset_container_intersection(const bitset_container_t *src_1,
const bitset_container_t *src_2,
container_t **dst);
/* Compute the intersection between src_1 and src_2 and write the result to
* dst. It is allowed for dst to be equal to src_1. We assume that dst is a
* valid container. */
void array_run_container_intersection(const array_container_t *src_1,
const run_container_t *src_2,
array_container_t *dst);
/* Compute the intersection between src_1 and src_2 and write the result to
* *dst. If the result is true then the result is a bitset_container_t
* otherwise is a array_container_t.
* If *dst == src_2, then an in-place intersection is attempted
**/
bool run_bitset_container_intersection(const run_container_t *src_1,
const bitset_container_t *src_2,
container_t **dst);
/* Compute the size of the intersection between src_1 and src_2 . */
int array_run_container_intersection_cardinality(const array_container_t *src_1,
const run_container_t *src_2);
/* Compute the size of the intersection between src_1 and src_2
**/
int run_bitset_container_intersection_cardinality(const run_container_t *src_1,
const bitset_container_t *src_2);
/* Check that src_1 and src_2 intersect. */
bool array_run_container_intersect(const array_container_t *src_1,
const run_container_t *src_2);
/* Check that src_1 and src_2 intersect.
**/
bool run_bitset_container_intersect(const run_container_t *src_1,
const bitset_container_t *src_2);
/*
* Same as bitset_bitset_container_intersection except that if the output is to
* be a
* bitset_container_t, then src_1 is modified and no allocation is made.
* If the output is to be an array_container_t, then caller is responsible
* to free the container.
* In all cases, the result is in *dst.
*/
bool bitset_bitset_container_intersection_inplace(
bitset_container_t *src_1, const bitset_container_t *src_2,
container_t **dst);
#ifdef __cplusplus
} } } // extern "C" { namespace roaring { namespace internal {
#endif
#endif /* INCLUDE_CONTAINERS_MIXED_INTERSECTION_H_ */
|