Skip to content

Commit 3b05334

Browse files
authored
Merge pull request #19 from RoaringBitmap/dlemire/updating_croaring
Updating croaring.
2 parents eef1b13 + eb97182 commit 3b05334

File tree

3 files changed

+695
-443
lines changed

3 files changed

+695
-443
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,31 @@ for i in bitmap {
100100

101101
You can build using Swift Package Manager as follows:
102102

103-
```bash
103+
```bash
104104
swift build --configuration release
105-
$(swift build --configuration release --show-bin-path)/fun
106105
```
106+
To find where the library is built, type the following
107+
in your shell:
108+
```bash
109+
echo $(swift build --configuration release --show-bin-path)
110+
```
111+
107112
You can run tests using Swift Package Manager as follows:
108-
```bash
113+
```bash
109114
swift test
110115
```
111116

112117
### Interactive use
113118

114119
```
115-
$ swift build -Xcc -march=native --configuration release
116-
$ swift -I .build/release -L .build/release -lSwiftRoaringDynamic
120+
$ swift build --configuration release
121+
$ swift repl -I .build/release -L .build/release -lSwiftRoaringDynamic
117122
1> import SwiftRoaring
118123
2> let bitmap = RoaringBitmap()
119124
3> bitmap.add(1)
125+
4> for i in bitmap {
126+
print(i)
127+
}
120128
```
121129

122130
### Mailing list/discussion group

Sources/CRoaring/include/roaring.h

Lines changed: 98 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
2-
// Created by amalgamation.sh on Wed 8 Jun 2022 15:13:10 EDT
2+
// Created by amalgamation.sh on 2022-11-11T14:36:13Z
33

44
/*
5-
* Copyright 2016-2020 The CRoaring authors
5+
* The CRoaring project is under a dual license (Apache/MIT).
6+
* Users of the library may choose one or the other license.
7+
*/
8+
/*
9+
* Copyright 2016-2022 The CRoaring authors
610
*
711
* Licensed under the Apache License, Version 2.0 (the "License");
812
* you may not use this file except in compliance with the License.
@@ -18,16 +22,47 @@
1822
*
1923
* SPDX-License-Identifier: Apache-2.0
2024
*/
25+
/*
26+
* MIT License
27+
*
28+
* Copyright 2016-2022 The CRoaring authors
29+
*
30+
* Permission is hereby granted, free of charge, to any
31+
* person obtaining a copy of this software and associated
32+
* documentation files (the "Software"), to deal in the
33+
* Software without restriction, including without
34+
* limitation the rights to use, copy, modify, merge,
35+
* publish, distribute, sublicense, and/or sell copies of
36+
* the Software, and to permit persons to whom the Software
37+
* is furnished to do so, subject to the following
38+
* conditions:
39+
*
40+
* The above copyright notice and this permission notice
41+
* shall be included in all copies or substantial portions
42+
* of the Software.
43+
*
44+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
45+
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
46+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
47+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
48+
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
49+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
50+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
51+
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
52+
* DEALINGS IN THE SOFTWARE.
53+
*
54+
* SPDX-License-Identifier: MIT
55+
*/
2156

2257
/* begin file include/roaring/roaring_version.h */
2358
// /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand
2459
#ifndef ROARING_INCLUDE_ROARING_VERSION
2560
#define ROARING_INCLUDE_ROARING_VERSION
26-
#define ROARING_VERSION "0.5.0"
61+
#define ROARING_VERSION "0.7.3"
2762
enum {
2863
ROARING_VERSION_MAJOR = 0,
29-
ROARING_VERSION_MINOR = 5,
30-
ROARING_VERSION_REVISION = 0
64+
ROARING_VERSION_MINOR = 7,
65+
ROARING_VERSION_REVISION = 3
3166
};
3267
#endif // ROARING_INCLUDE_ROARING_VERSION
3368
/* end file include/roaring/roaring_version.h */
@@ -394,9 +429,48 @@ void roaring_bitmap_andnot_inplace(roaring_bitmap_t *r1,
394429
*/
395430
void roaring_bitmap_free(const roaring_bitmap_t *r);
396431

432+
/**
433+
* A bit of context usable with `roaring_bitmap_*_bulk()` functions
434+
*
435+
* Should be initialized with `{0}` (or `memset()` to all zeros).
436+
* Callers should treat it as an opaque type.
437+
*
438+
* A context may only be used with a single bitmap
439+
* (unless re-initialized to zero), and any modification to a bitmap
440+
* (other than modifications performed with `_bulk()` functions with the context
441+
* passed) will invalidate any contexts associated with that bitmap.
442+
*/
443+
typedef struct roaring_bulk_context_s {
444+
ROARING_CONTAINER_T *container;
445+
int idx;
446+
uint16_t key;
447+
uint8_t typecode;
448+
} roaring_bulk_context_t;
449+
450+
/**
451+
* Add an item, using context from a previous insert for speed optimization.
452+
*
453+
* `context` will be used to store information between calls to make bulk
454+
* operations faster. `*context` should be zero-initialized before the first
455+
* call to this function.
456+
*
457+
* Modifying the bitmap in any way (other than `-bulk` suffixed functions)
458+
* will invalidate the stored context, calling this function with a non-zero
459+
* context after doing any modification invokes undefined behavior.
460+
*
461+
* In order to exploit this optimization, the caller should call this function
462+
* with values with the same "key" (high 16 bits of the value) consecutively.
463+
*/
464+
void roaring_bitmap_add_bulk(roaring_bitmap_t *r,
465+
roaring_bulk_context_t *context, uint32_t val);
466+
397467
/**
398468
* Add value n_args from pointer vals, faster than repeatedly calling
399469
* `roaring_bitmap_add()`
470+
*
471+
* In order to exploit this optimization, the caller should attempt to keep
472+
* values with the same "key" (high 16 bits of the value) as consecutive
473+
* elements in `vals`
400474
*/
401475
void roaring_bitmap_add_many(roaring_bitmap_t *r, size_t n_args,
402476
const uint32_t *vals);
@@ -472,6 +546,25 @@ bool roaring_bitmap_contains_range(const roaring_bitmap_t *r,
472546
uint64_t range_start,
473547
uint64_t range_end);
474548

549+
/**
550+
* Check if an items is present, using context from a previous insert for speed
551+
* optimization.
552+
*
553+
* `context` will be used to store information between calls to make bulk
554+
* operations faster. `*context` should be zero-initialized before the first
555+
* call to this function.
556+
*
557+
* Modifying the bitmap in any way (other than `-bulk` suffixed functions)
558+
* will invalidate the stored context, calling this function with a non-zero
559+
* context after doing any modification invokes undefined behavior.
560+
*
561+
* In order to exploit this optimization, the caller should call this function
562+
* with values with the same "key" (high 16 bits of the value) consecutively.
563+
*/
564+
bool roaring_bitmap_contains_bulk(const roaring_bitmap_t *r,
565+
roaring_bulk_context_t *context,
566+
uint32_t val);
567+
475568
/**
476569
* Get the cardinality of the bitmap (number of elements).
477570
*/
@@ -951,7 +1044,6 @@ uint32_t roaring_read_uint32_iterator(roaring_uint32_iterator_t *it,
9511044
using namespace ::roaring::api;
9521045
#endif
9531046
#endif
954-
9551047
/* end file include/roaring/roaring.h */
9561048
/* begin file include/roaring/memory.h */
9571049
#ifndef INCLUDE_ROARING_MEMORY_H_

0 commit comments

Comments
 (0)