Skip to content

Commit

Permalink
Merge pull request #19 from RoaringBitmap/dlemire/updating_croaring
Browse files Browse the repository at this point in the history
Updating croaring.
  • Loading branch information
lemire committed Nov 11, 2022
2 parents eef1b13 + eb97182 commit 3b05334
Show file tree
Hide file tree
Showing 3 changed files with 695 additions and 443 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,31 @@ for i in bitmap {

You can build using Swift Package Manager as follows:

```bash
```bash
swift build --configuration release
$(swift build --configuration release --show-bin-path)/fun
```
To find where the library is built, type the following
in your shell:
```bash
echo $(swift build --configuration release --show-bin-path)
```

You can run tests using Swift Package Manager as follows:
```bash
```bash
swift test
```

### Interactive use

```
$ swift build -Xcc -march=native --configuration release
$ swift -I .build/release -L .build/release -lSwiftRoaringDynamic
$ swift build --configuration release
$ swift repl -I .build/release -L .build/release -lSwiftRoaringDynamic
1> import SwiftRoaring
2> let bitmap = RoaringBitmap()
3> bitmap.add(1)
4> for i in bitmap {
print(i)
}
```

### Mailing list/discussion group
Expand Down
104 changes: 98 additions & 6 deletions Sources/CRoaring/include/roaring.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
// Created by amalgamation.sh on Wed 8 Jun 2022 15:13:10 EDT
// Created by amalgamation.sh on 2022-11-11T14:36:13Z

/*
* 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.
Expand All @@ -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.5.0"
#define ROARING_VERSION "0.7.3"
enum {
ROARING_VERSION_MAJOR = 0,
ROARING_VERSION_MINOR = 5,
ROARING_VERSION_REVISION = 0
ROARING_VERSION_MINOR = 7,
ROARING_VERSION_REVISION = 3
};
#endif // ROARING_INCLUDE_ROARING_VERSION
/* end file include/roaring/roaring_version.h */
Expand Down Expand Up @@ -394,9 +429,48 @@ void roaring_bitmap_andnot_inplace(roaring_bitmap_t *r1,
*/
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`
*/
void roaring_bitmap_add_many(roaring_bitmap_t *r, size_t n_args,
const uint32_t *vals);
Expand Down Expand Up @@ -472,6 +546,25 @@ 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).
*/
Expand Down Expand Up @@ -951,7 +1044,6 @@ 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_
Expand Down
Loading

0 comments on commit 3b05334

Please sign in to comment.