Skip to content

Commit 4cdfc40

Browse files
committed
lint
1 parent f22aef5 commit 4cdfc40

7 files changed

Lines changed: 34 additions & 26 deletions

File tree

include/roaring/array_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ namespace internal {
4242
* if ( x<0 ) then inserting ikey at position -x-1 in array (insuring that
4343
* array[-x-1]=ikey) keys the array sorted.
4444
*/
45-
croaring_really_inline int32_t binarySearch(const uint16_t *array, int32_t lenarray,
46-
uint16_t ikey) {
45+
croaring_really_inline int32_t binarySearch(const uint16_t *array,
46+
int32_t lenarray, uint16_t ikey) {
4747
int32_t low = 0;
4848
int32_t high = lenarray - 1;
4949
while (low <= high) {

include/roaring/containers/array.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,14 @@ static inline bool array_container_remove(array_container_t *arr,
339339
}
340340

341341
/* Check whether x is present. */
342-
static croaring_really_inline bool array_container_contains(const array_container_t *arr, uint16_t pos) {
342+
croaring_really_inline bool array_container_contains(
343+
const array_container_t *arr, uint16_t pos) {
343344
const int32_t gap = 16;
344345
const uint16_t *carr = arr->array;
345346
int32_t cardinality = arr->cardinality;
346347
if (cardinality < gap) {
347-
for (int32_t j = 0; j < cardinality; j++) {
348-
if (carr[j] >= pos) return carr[j] == pos;
348+
for (int32_t j = 0; j < cardinality; j++) {
349+
if (carr[j] >= pos) return carr[j] == pos;
349350
}
350351
return false;
351352
}
@@ -365,7 +366,8 @@ static croaring_really_inline bool array_container_contains(const array_containe
365366
uint16x8_t needle = vdupq_n_u16(pos);
366367
uint16x8_t v0 = vld1q_u16(blk);
367368
uint16x8_t v1 = vld1q_u16(blk + 8);
368-
uint16x8_t hit = vorrq_u16(vceqq_u16(v0, needle), vceqq_u16(v1, needle));
369+
uint16x8_t hit =
370+
vorrq_u16(vceqq_u16(v0, needle), vceqq_u16(v1, needle));
369371
return vmaxvq_u16(hit) != 0;
370372
#elif defined(CROARING_IS_X64)
371373
__m128i needle = _mm_set1_epi16((short)pos);
@@ -375,15 +377,16 @@ static croaring_really_inline bool array_container_contains(const array_containe
375377
_mm_cmpeq_epi16(v1, needle));
376378
return _mm_movemask_epi8(hit) != 0;
377379
#else
378-
// SWAR fallback: compare 16 values in parallel using bitwise operations.
380+
// SWAR fallback: compare 16 values in parallel using bitwise
381+
// operations.
379382
uint64_t broadcast = 0x0001000100010001ULL * pos;
380-
const uint64_t ones = 0x0001000100010001ULL;
383+
const uint64_t ones = 0x0001000100010001ULL;
381384
const uint64_t highs = 0x8000800080008000ULL;
382385

383386
uint64_t w0, w1, w2, w3;
384-
memcpy(&w0, blk, sizeof(uint64_t));
385-
memcpy(&w1, blk + 4, sizeof(uint64_t));
386-
memcpy(&w2, blk + 8, sizeof(uint64_t));
387+
memcpy(&w0, blk, sizeof(uint64_t));
388+
memcpy(&w1, blk + 4, sizeof(uint64_t));
389+
memcpy(&w2, blk + 8, sizeof(uint64_t));
387390
memcpy(&w3, blk + 12, sizeof(uint64_t));
388391

389392
// XOR: a lane is zero iff that element equals x

include/roaring/containers/bitset.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ static inline bool bitset_container_remove(bitset_container_t *bitset,
189189
}
190190

191191
/* Get the value of the ith bit. */
192-
croaring_really_inline bool bitset_container_get(const bitset_container_t *bitset,
193-
uint16_t pos) {
192+
croaring_really_inline bool bitset_container_get(
193+
const bitset_container_t *bitset, uint16_t pos) {
194194
const uint64_t word = bitset->words[pos >> 6];
195195
return (word >> (pos & 63)) & 1;
196196
}
@@ -228,8 +228,8 @@ static inline bool bitset_container_get_range(const bitset_container_t *bitset,
228228
}
229229

230230
/* Check whether `bitset' is present in `array'. Calls bitset_container_get. */
231-
croaring_really_inline bool bitset_container_contains(const bitset_container_t *bitset,
232-
uint16_t pos) {
231+
croaring_really_inline bool bitset_container_contains(
232+
const bitset_container_t *bitset, uint16_t pos) {
233233
return bitset_container_get(bitset, pos);
234234
}
235235

include/roaring/containers/run.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ static inline void recoverRoomAtIndex(run_container_t *run, uint16_t index) {
108108
/**
109109
* Good old binary search through rle data
110110
*/
111-
croaring_really_inline int32_t interleavedBinarySearch(const rle16_t *array, int32_t lenarray,
112-
uint16_t ikey) {
111+
croaring_really_inline int32_t interleavedBinarySearch(const rle16_t *array,
112+
int32_t lenarray,
113+
uint16_t ikey) {
113114
int32_t low = 0;
114115
int32_t high = lenarray - 1;
115116
while (low <= high) {
@@ -257,7 +258,8 @@ static inline bool run_container_remove(run_container_t *run, uint16_t pos) {
257258
}
258259

259260
/* Check whether `pos' is present in `run'. */
260-
croaring_really_inline bool run_container_contains(const run_container_t *run, uint16_t pos) {
261+
croaring_really_inline bool run_container_contains(const run_container_t *run,
262+
uint16_t pos) {
261263
int32_t index = interleavedBinarySearch(run->runs, run->n_runs, pos);
262264
if (index >= 0) return true;
263265
index = -index - 2; // points to preceding value, possibly -1

include/roaring/portability.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ extern "C" { // portability definitions are in global scope, not a namespace
7777
#ifndef __restrict__
7878
#define __restrict__ __restrict
7979
#endif // __restrict__
80-
#ifndef croaring_really_inline
81-
#define __forceinline
80+
#ifndef croaring_really_inline
81+
#define __forceinline
8282
#endif // croaring_really_inline
8383
#endif // CROARING_REGULAR_VISUAL_STUDIO
8484

8585
#if defined(__GNUC__) || defined(__clang__)
8686
#ifndef croaring_really_inline
8787
#define croaring_really_inline __attribute__((always_inline)) inline
8888
#endif // croaring_really_inline
89-
#endif // defined(__GNUC__) || defined(__clang__)
89+
#endif // defined(__GNUC__) || defined(__clang__)
9090

9191
#ifndef croaring_really_inline
9292
#define croaring_really_inline inline

include/roaring/roaring.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ bool roaring_bitmap_remove_checked(roaring_bitmap_t *r, uint32_t x);
475475
/**
476476
* Check if value is present
477477
*/
478-
croaring_really_inline bool roaring_bitmap_contains(const roaring_bitmap_t *r, uint32_t val) {
478+
croaring_really_inline bool roaring_bitmap_contains(const roaring_bitmap_t *r,
479+
uint32_t val) {
479480
// For performance reasons, this function is inline and uses internal
480481
// functions directly.
481482
#ifdef __cplusplus

include/roaring/roaring_array.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,26 @@ void ra_clear_containers(roaring_array_t *ra);
9090
/**
9191
* Get the index corresponding to a 16-bit key
9292
*/
93-
croaring_really_inline int32_t ra_get_index(const roaring_array_t *ra, uint16_t x) {
93+
croaring_really_inline int32_t ra_get_index(const roaring_array_t *ra,
94+
uint16_t x) {
9495
if ((ra->size == 0) || ra->keys[ra->size - 1] == x) return ra->size - 1;
9596
return binarySearch(ra->keys, (int32_t)ra->size, x);
9697
}
9798

9899
/**
99100
* Retrieves the container at index i, filling in the typecode
100101
*/
101-
croaring_really_inline container_t *ra_get_container_at_index(const roaring_array_t *ra,
102-
uint16_t i, uint8_t *typecode) {
102+
croaring_really_inline container_t *ra_get_container_at_index(
103+
const roaring_array_t *ra, uint16_t i, uint8_t *typecode) {
103104
*typecode = ra->typecodes[i];
104105
return ra->containers[i];
105106
}
106107

107108
/**
108109
* Retrieves the key at index i
109110
*/
110-
croaring_really_inline uint16_t ra_get_key_at_index(const roaring_array_t *ra, uint16_t i) {
111+
croaring_really_inline uint16_t ra_get_key_at_index(const roaring_array_t *ra,
112+
uint16_t i) {
111113
return ra->keys[i];
112114
}
113115

0 commit comments

Comments
 (0)