diff options
author | Luca Deri <deri@ntop.org> | 2022-05-28 16:06:34 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2022-05-28 16:06:34 +0200 |
commit | 77dc884a4c5dbe5111a6723d64c9e8b1a57c40b3 (patch) | |
tree | a209360d6892bca4d4603a389a638743ad717cab | |
parent | 7e3d0614287bba51d881c89e75c1f9671cccd1b8 (diff) |
Compilation fixes for old gcc compiler
-rw-r--r-- | example/ndpiReader.c | 13 | ||||
-rw-r--r-- | src/lib/ndpi_utils.c | 14 | ||||
-rw-r--r-- | src/lib/third_party/src/roaring.cc | 327 |
3 files changed, 182 insertions, 172 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 96b11a706..f8886fed1 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -364,7 +364,7 @@ flowGetBDMeanandVariance(struct ndpi_flow_info* flow) { if (!flow->bidirectional) { array = last_entropy->src2dst_byte_count; num_bytes = last_entropy->src2dst_l4_bytes; - for (i=0; i<256; i++) { + for(i=0; i<256; i++) { tmp[i] = last_entropy->src2dst_byte_count[i]; } @@ -378,7 +378,7 @@ flowGetBDMeanandVariance(struct ndpi_flow_info* flow) { } } } else { - for (i=0; i<256; i++) { + for(i=0; i<256; i++) { tmp[i] = last_entropy->src2dst_byte_count[i] + last_entropy->dst2src_byte_count[i]; } array = tmp; @@ -1640,7 +1640,9 @@ static void printFlowSerialized(u_int16_t thread_id, ndpi_serialize_start_of_list(serializer, "risks"); if (flow->risk != NDPI_NO_RISK) { - for (u_int32_t i = 0; i < NDPI_MAX_RISK; ++i) + u_int32_t i; + + for(i = 0; i < NDPI_MAX_RISK; ++i) { if (NDPI_ISSET_BIT(flow->risk, i) != 0) { @@ -3260,9 +3262,8 @@ static void printFlowsStats() { unsigned int i; num_flows = 0; - for (thread_id = 0; thread_id < num_threads; thread_id++) { - for (i = 0; i < NUM_ROOTS; i++) - { + for(thread_id = 0; thread_id < num_threads; thread_id++) { + for(i = 0; i < NUM_ROOTS; i++) { ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], node_print_known_proto_walker, &thread_id); ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 3f27964c6..e5739ae5c 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -2260,8 +2260,9 @@ int ndpi_isset_risk(struct ndpi_detection_module_struct *ndpi_str, int ndpi_is_printable_string(char * const str, size_t len) { int retval = 1; + size_t i; - for (size_t i = 0; i < len; ++i) { + for(i = 0; i < len; ++i) { if(ndpi_isprint(str[i]) == 0) { str[i] = '?'; retval = 0; @@ -2274,7 +2275,9 @@ int ndpi_is_printable_string(char * const str, size_t len) { /* ******************************************************************** */ int ndpi_is_valid_hostname(char * const str, size_t len) { - for (size_t i = 0; i < len; ++i) { + size_t i; + + for(i = 0; i < len; ++i) { if((str[i] == '.') || (str[i] == '-') || (str[i] == '_') @@ -2297,14 +2300,15 @@ int ndpi_is_valid_hostname(char * const str, size_t len) { float ndpi_entropy(u_int8_t const * const buf, size_t len) { float entropy = 0.0f; u_int32_t byte_counters[256]; + size_t i; memset(byte_counters, 0, sizeof(byte_counters)); - for (size_t i = 0; i < len; ++i) { + for(i = 0; i < len; ++i) { byte_counters[buf[i]]++; } - for (size_t i = 0; i < sizeof(byte_counters) / sizeof(byte_counters[0]); ++i) { + for(i = 0; i < sizeof(byte_counters) / sizeof(byte_counters[0]); ++i) { if(byte_counters[i] == 0) { continue; } @@ -2330,7 +2334,7 @@ u_int16_t ndpi_calculate_icmp4_checksum(const u_int8_t * buf, size_t len) { * The next two bytes is the checksum, which we want to ignore. */ - for (; len > 1; len -= 2) { + for(; len > 1; len -= 2) { checksum += get_n16bit(buf); buf += 2; } diff --git a/src/lib/third_party/src/roaring.cc b/src/lib/third_party/src/roaring.cc index 2fccfb129..8b0e1b2b4 100644 --- a/src/lib/third_party/src/roaring.cc +++ b/src/lib/third_party/src/roaring.cc @@ -1073,7 +1073,7 @@ static inline void bitset_set_range(uint64_t *words, uint32_t start, return; } words[firstword] |= (~UINT64_C(0)) << (start % 64); - for (uint32_t i = firstword + 1; i < endword; i++) { + uint32_t i; for (i = firstword + 1; i < endword; i++) { words[i] = ~UINT64_C(0); } words[endword] |= (~UINT64_C(0)) >> ((~end + 1) % 64); @@ -1094,7 +1094,7 @@ static inline int bitset_lenrange_cardinality(const uint64_t *words, << (start % 64)); } int answer = hamming(words[firstword] & ((~UINT64_C(0)) << (start % 64))); - for (uint32_t i = firstword + 1; i < endword; i++) { + uint32_t i; for (i = firstword + 1; i < endword; i++) { answer += hamming(words[i]); } answer += @@ -1117,7 +1117,7 @@ static inline bool bitset_lenrange_empty(const uint64_t *words, uint32_t start, if (((words[firstword] & ((~UINT64_C(0)) << (start%64)))) != 0) { return false; } - for (uint32_t i = firstword + 1; i < endword; i++) { + uint32_t i; for (i = firstword + 1; i < endword; i++) { if (words[i] != 0) { return false; } @@ -1143,7 +1143,7 @@ static inline void bitset_set_lenrange(uint64_t *words, uint32_t start, } uint64_t temp = words[endword]; words[firstword] |= (~UINT64_C(0)) << (start % 64); - for (uint32_t i = firstword + 1; i < endword; i += 2) + uint32_t i; for (i = firstword + 1; i < endword; i += 2) words[i] = words[i + 1] = ~UINT64_C(0); words[endword] = temp | (~UINT64_C(0)) >> (((~start + 1) - lenminusone - 1) % 64); @@ -1158,7 +1158,7 @@ static inline void bitset_flip_range(uint64_t *words, uint32_t start, uint32_t firstword = start / 64; uint32_t endword = (end - 1) / 64; words[firstword] ^= ~((~UINT64_C(0)) << (start % 64)); - for (uint32_t i = firstword; i < endword; i++) { + uint32_t i; for (i = firstword; i < endword; i++) { words[i] = ~words[i]; } words[endword] ^= ((~UINT64_C(0)) >> ((~end + 1) % 64)); @@ -1178,7 +1178,7 @@ static inline void bitset_reset_range(uint64_t *words, uint32_t start, return; } words[firstword] &= ~((~UINT64_C(0)) << (start % 64)); - for (uint32_t i = firstword + 1; i < endword; i++) { + uint32_t i; for (i = firstword + 1; i < endword; i++) { words[i] = UINT64_C(0); } words[endword] &= ~((~UINT64_C(0)) >> ((~end + 1) % 64)); @@ -1980,7 +1980,8 @@ static inline bool array_container_contains(const array_container_t *arr, } } - for (int i=low; i <= high; i++) { + int i; + for (i=low; i <= high; i++) { uint16_t v = carr[i]; if (v == pos) { return true; @@ -2060,7 +2061,7 @@ static inline void array_container_add_range_nvals(array_container_t *array, memmove(&(array->array[union_cardinality - nvals_greater]), &(array->array[array->cardinality - nvals_greater]), nvals_greater * sizeof(uint16_t)); - for (uint32_t i = 0; i <= max - min; i++) { + uint32_t i; for (i = 0; i <= max - min; i++) { array->array[nvals_less + i] = min + i; } array->cardinality = union_cardinality; @@ -2301,7 +2302,7 @@ static inline bool bitset_container_get_range(const bitset_container_t *bitset, return false; } - for (uint16_t i = start + 1; (i < BITSET_CONTAINER_SIZE_IN_WORDS) && (i < end); ++i){ + uint16_t i; for (i = start + 1; (i < BITSET_CONTAINER_SIZE_IN_WORDS) && (i < end); ++i){ if (bitset->words[i] != UINT64_C(0xFFFFFFFFFFFFFFFF)) return false; } @@ -2361,7 +2362,7 @@ static inline bool bitset_container_nonzero_cardinality( static inline bool bitset_container_empty( const bitset_container_t *bitset) { if (bitset->cardinality == BITSET_UNKNOWN_CARDINALITY) { - for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i ++) { + int i = 0; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i ++) { if((bitset->words[i]) != 0) return false; } return true; @@ -2859,7 +2860,7 @@ static inline bool run_container_contains_range(const run_container_t *run, return false; } } - for (int32_t i = index; i < run->n_runs; ++i) { + int32_t i; for (i = index; i < run->n_runs; ++i) { const uint32_t stop = run->runs[i].value + run->runs[i].length; if (run->runs[i].value >= pos_end) break; if (stop >= pos_end) { @@ -7222,7 +7223,7 @@ static bool ra_overwrite(const roaring_array_t *source, roaring_array_t *dest, memcpy(dest->keys, source->keys, dest->size * sizeof(uint16_t)); // we go through the containers, turning them into shared containers... if (copy_on_write) { - for (int32_t i = 0; i < dest->size; ++i) { + int32_t i; for (i = 0; i < dest->size; ++i) { source->containers[i] = get_copy_of_container( source->containers[i], &source->typecodes[i], copy_on_write); } @@ -7234,11 +7235,11 @@ static bool ra_overwrite(const roaring_array_t *source, roaring_array_t *dest, } else { memcpy(dest->typecodes, source->typecodes, dest->size * sizeof(uint8_t)); - for (int32_t i = 0; i < dest->size; i++) { + int32_t i; for (i = 0; i < dest->size; i++) { dest->containers[i] = container_clone(source->containers[i], source->typecodes[i]); if (dest->containers[i] == NULL) { - for (int32_t j = 0; j < i; j++) { + int32_t j; for (j = 0; j < i; j++) { container_free(dest->containers[j], dest->typecodes[j]); } ra_clear_without_containers(dest); @@ -7250,7 +7251,7 @@ static bool ra_overwrite(const roaring_array_t *source, roaring_array_t *dest, } static void ra_clear_containers(roaring_array_t *ra) { - for (int32_t i = 0; i < ra->size; ++i) { + int32_t i; for (i = 0; i < ra->size; ++i) { container_free(ra->containers[i], ra->typecodes[i]); } } @@ -7326,7 +7327,7 @@ static void ra_append_copy(roaring_array_t *ra, const roaring_array_t *sa, static void ra_append_copies_until(roaring_array_t *ra, const roaring_array_t *sa, uint16_t stopping_key, bool copy_on_write) { - for (int32_t i = 0; i < sa->size; ++i) { + int32_t i; for (i = 0; i < sa->size; ++i) { if (sa->keys[i] >= stopping_key) break; ra_append_copy(ra, sa, i, copy_on_write); } @@ -7336,7 +7337,7 @@ static void ra_append_copy_range(roaring_array_t *ra, const roaring_array_t *sa, int32_t start_index, int32_t end_index, bool copy_on_write) { extend_array(ra, end_index - start_index); - for (int32_t i = start_index; i < end_index; ++i) { + int32_t i; for (i = start_index; i < end_index; ++i) { const int32_t pos = ra->size; ra->keys[pos] = sa->keys[i]; if (copy_on_write) { @@ -7367,7 +7368,7 @@ static void ra_append_move_range(roaring_array_t *ra, roaring_array_t *sa, int32_t start_index, int32_t end_index) { extend_array(ra, end_index - start_index); - for (int32_t i = start_index; i < end_index; ++i) { + int32_t i; for (i = start_index; i < end_index; ++i) { const int32_t pos = ra->size; ra->keys[pos] = sa->keys[i]; @@ -7382,7 +7383,7 @@ static void ra_append_range(roaring_array_t *ra, roaring_array_t *sa, bool copy_on_write) { extend_array(ra, end_index - start_index); - for (int32_t i = start_index; i < end_index; ++i) { + int32_t i; for (i = start_index; i < end_index; ++i) { const int32_t pos = ra->size; ra->keys[pos] = sa->keys[i]; if (copy_on_write) { @@ -7535,7 +7536,7 @@ static void ra_shift_tail(roaring_array_t *ra, int32_t count, int32_t distance) static void ra_to_uint32_array(const roaring_array_t *ra, uint32_t *ans) { size_t ctr = 0; - for (int32_t i = 0; i < ra->size; ++i) { + int32_t i; for (i = 0; i < ra->size; ++i) { int num_added = container_to_uint32_array( ans + ctr, ra->containers[i], ra->typecodes[i], ((uint32_t)ra->keys[i]) << 16); @@ -7555,7 +7556,7 @@ static bool ra_range_uint32_array(const roaring_array_t *ra, size_t offset, size uint32_t *t_ans = NULL; size_t cur_len = 0; - for (int i = 0; i < ra->size; ++i) { + int i = 0; for (i = 0; i < ra->size; ++i) { const container_t *c = container_unwrap_shared( ra->containers[i], &ra->typecodes[i]); @@ -7627,7 +7628,7 @@ static bool ra_range_uint32_array(const roaring_array_t *ra, size_t offset, size } static bool ra_has_run_container(const roaring_array_t *ra) { - for (int32_t k = 0; k < ra->size; ++k) { + int32_t k; for (k = 0; k < ra->size; ++k) { if (get_container_type(ra->containers[k], ra->typecodes[k]) == RUN_CONTAINER_TYPE) return true; @@ -7651,7 +7652,7 @@ static uint32_t ra_portable_header_size(const roaring_array_t *ra) { static size_t ra_portable_size_in_bytes(const roaring_array_t *ra) { size_t count = ra_portable_header_size(ra); - for (int32_t k = 0; k < ra->size; ++k) { + int32_t k; for (k = 0; k < ra->size; ++k) { count += container_size_in_bytes(ra->containers[k], ra->typecodes[k]); } return count; @@ -7668,7 +7669,7 @@ static size_t ra_portable_serialize(const roaring_array_t *ra, char *buf) { uint32_t s = (ra->size + 7) / 8; uint8_t *bitmapOfRunContainers = (uint8_t *)calloc(s, 1); assert(bitmapOfRunContainers != NULL); // todo: handle - for (int32_t i = 0; i < ra->size; ++i) { + int32_t i; for (i = 0; i < ra->size; ++i) { if (get_container_type(ra->containers[i], ra->typecodes[i]) == RUN_CONTAINER_TYPE) { bitmapOfRunContainers[i / 8] |= (1 << (i % 8)); @@ -7692,7 +7693,7 @@ static size_t ra_portable_serialize(const roaring_array_t *ra, char *buf) { startOffset = 4 + 4 + 4 * ra->size + 4 * ra->size; } - for (int32_t k = 0; k < ra->size; ++k) { + int32_t k; for (k = 0; k < ra->size; ++k) { memcpy(buf, &ra->keys[k], sizeof(ra->keys[k])); buf += sizeof(ra->keys[k]); // get_cardinality returns a value in [1,1<<16], subtracting one @@ -7704,7 +7705,7 @@ static size_t ra_portable_serialize(const roaring_array_t *ra, char *buf) { } if ((!hasrun) || (ra->size >= NO_OFFSET_THRESHOLD)) { // writing the containers offsets - for (int32_t k = 0; k < ra->size; k++) { + int32_t k; for (k = 0; k < ra->size; k++) { memcpy(buf, &startOffset, sizeof(startOffset)); buf += sizeof(startOffset); startOffset = @@ -7712,7 +7713,7 @@ static size_t ra_portable_serialize(const roaring_array_t *ra, char *buf) { container_size_in_bytes(ra->containers[k], ra->typecodes[k]); } } - for (int32_t k = 0; k < ra->size; ++k) { + for (k = 0; k < ra->size; ++k) { buf += container_write(ra->containers[k], ra->typecodes[k], buf); } return buf - initbuf; @@ -7768,7 +7769,7 @@ static size_t ra_portable_deserialize_size(const char *buf, const size_t maxbyte buf += size * 4; } // Reading the containers - for (int32_t k = 0; k < size; ++k) { + int32_t k; for (k = 0; k < size; ++k) { uint16_t tmp; memcpy(&tmp, keyscards + 2*k+1, sizeof(tmp)); uint32_t thiscard = tmp + 1; @@ -7869,7 +7870,7 @@ static bool ra_portable_deserialize(roaring_array_t *answer, const char *buf, co return false; } - for (int32_t k = 0; k < size; ++k) { + int32_t k; for (k = 0; k < size; ++k) { uint16_t tmp; memcpy(&tmp, keyscards + 2*k, sizeof(tmp)); answer->keys[k] = tmp; @@ -7886,7 +7887,7 @@ static bool ra_portable_deserialize(roaring_array_t *answer, const char *buf, co buf += size * 4; } // Reading the containers - for (int32_t k = 0; k < size; ++k) { + for (k = 0; k < size; ++k) { uint16_t tmp; memcpy(&tmp, keyscards + 2*k+1, sizeof(tmp)); uint32_t thiscard = tmp + 1; @@ -8050,14 +8051,17 @@ static roaring_pq_t *create_pq(const roaring_bitmap_t **arr, uint32_t length) { roaring_pq_t *answer = (roaring_pq_t *)malloc(alloc_size); answer->elements = (roaring_pq_element_t *)(answer + 1); answer->size = length; - for (uint32_t i = 0; i < length; i++) { + uint32_t i; for (i = 0; i < length; i++) { answer->elements[i].bitmap = (roaring_bitmap_t *)arr[i]; answer->elements[i].is_temporary = false; answer->elements[i].size = roaring_bitmap_portable_size_in_bytes(arr[i]); } - for (int32_t i = (length >> 1); i >= 0; i--) { + { + int32_t i; + for (i = (length >> 1); i >= 0; i--) { percolate_down(answer, i); + } } return answer; } @@ -8365,7 +8369,7 @@ static roaring_bitmap_t *roaring_bitmap_of(size_t n_args, ...) { roaring_bitmap_t *answer = roaring_bitmap_create(); va_list ap; va_start(ap, n_args); - for (size_t i = 1; i <= n_args; i++) { + size_t i; for (i = 1; i <= n_args; i++) { uint32_t val = va_arg(ap, uint32_t); roaring_bitmap_add(answer, val); } @@ -8390,7 +8394,7 @@ static roaring_bitmap_t *roaring_bitmap_from_range(uint64_t min, uint64_t max, if (max <= min) return NULL; roaring_bitmap_t *answer = roaring_bitmap_create(); if (step >= (1 << 16)) { - for (uint32_t value = (uint32_t)min; value < max; value += step) { + uint32_t value; for (value = (uint32_t)min; value < max; value += step) { roaring_bitmap_add(answer, value); } return answer; @@ -8434,7 +8438,7 @@ static void roaring_bitmap_add_range_closed(roaring_bitmap_t *r, uint32_t min, u int32_t src = prefix_length + common_length - 1; int32_t dst = ra->size - suffix_length - 1; - for (uint32_t key = max_key; key != min_key-1; key--) { // beware of min_key==0 + uint32_t key; for ( key = max_key; key != min_key-1; key--) { // beware of min_key==0 uint32_t container_min = (min_key == key) ? (min & 0xffff) : 0; uint32_t container_max = (max_key == key) ? (max & 0xffff) : 0xffff; container_t* new_container; @@ -8506,7 +8510,7 @@ static void roaring_bitmap_printf(const roaring_bitmap_t *r) { const roaring_array_t *ra = &r->high_low_container; printf("{"); - for (int i = 0; i < ra->size; ++i) { + int i = 0; for (i = 0; i < ra->size; ++i) { container_printf_as_uint32_array(ra->containers[i], ra->typecodes[i], ((uint32_t)ra->keys[i]) << 16); @@ -8521,7 +8525,7 @@ static void roaring_bitmap_printf_describe(const roaring_bitmap_t *r) { const roaring_array_t *ra = &r->high_low_container; printf("{"); - for (int i = 0; i < ra->size; ++i) { + int i = 0; for (i = 0; i < ra->size; ++i) { printf("%d: %s (%d)", ra->keys[i], get_full_container_name(ra->containers[i], ra->typecodes[i]), container_get_cardinality(ra->containers[i], ra->typecodes[i])); @@ -8572,7 +8576,7 @@ static void roaring_bitmap_statistics(const roaring_bitmap_t *r, stat->max_value = mms.max; stat->sum_value = mms.sum; - for (int i = 0; i < ra->size; ++i) { + int i = 0; for (i = 0; i < ra->size; ++i) { uint8_t truetype = get_container_type(ra->containers[i], ra->typecodes[i]); uint32_t card = @@ -8778,7 +8782,7 @@ static void roaring_bitmap_remove_many(roaring_bitmap_t *r, size_t n_args, return; } int32_t pos = -1; // position of the container used in the previous iteration - for (size_t i = 0; i < n_args; i++) { + size_t i; for (i = 0; i < n_args; i++) { uint16_t key = (uint16_t)(vals[i] >> 16); if (pos < 0 || key != r->high_low_container.keys[pos]) { pos = ra_get_index(&r->high_low_container, key); @@ -8859,7 +8863,7 @@ static roaring_bitmap_t *roaring_bitmap_or_many(size_t number, } roaring_bitmap_t *answer = roaring_bitmap_lazy_or(x[0], x[1], LAZY_OR_BITSET_CONVERSION); - for (size_t i = 2; i < number; i++) { + size_t i; for (i = 2; i < number; i++) { roaring_bitmap_lazy_or_inplace(answer, x[i], LAZY_OR_BITSET_CONVERSION); } roaring_bitmap_repair_after_lazy(answer); @@ -8878,7 +8882,7 @@ static roaring_bitmap_t *roaring_bitmap_xor_many(size_t number, return roaring_bitmap_copy(x[0]); } roaring_bitmap_t *answer = roaring_bitmap_lazy_xor(x[0], x[1]); - for (size_t i = 2; i < number; i++) { + size_t i; for (i = 2; i < number; i++) { roaring_bitmap_lazy_xor_inplace(answer, x[i]); } roaring_bitmap_repair_after_lazy(answer); @@ -9433,7 +9437,7 @@ static uint64_t roaring_bitmap_get_cardinality(const roaring_bitmap_t *r) { const roaring_array_t *ra = &r->high_low_container; uint64_t card = 0; - for (int i = 0; i < ra->size; ++i) + int i = 0; for (i = 0; i < ra->size; ++i) card += container_get_cardinality(ra->containers[i], ra->typecodes[i]); return card; } @@ -9514,7 +9518,7 @@ static bool roaring_bitmap_range_uint32_array(const roaring_bitmap_t *r, */ static bool roaring_bitmap_run_optimize(roaring_bitmap_t *r) { bool answer = false; - for (int i = 0; i < r->high_low_container.size; i++) { + int i = 0; for (i = 0; i < r->high_low_container.size; i++) { uint8_t type_original, type_after; ra_unshare_container_at_index( &r->high_low_container, i); // TODO: this introduces extra cloning! @@ -9531,7 +9535,7 @@ static bool roaring_bitmap_run_optimize(roaring_bitmap_t *r) { static size_t roaring_bitmap_shrink_to_fit(roaring_bitmap_t *r) { size_t answer = 0; - for (int i = 0; i < r->high_low_container.size; i++) { + int i = 0; for (i = 0; i < r->high_low_container.size; i++) { uint8_t type_original; container_t *c = ra_get_container_at_index(&r->high_low_container, i, &type_original); @@ -9547,7 +9551,7 @@ static size_t roaring_bitmap_shrink_to_fit(roaring_bitmap_t *r) { */ static bool roaring_bitmap_remove_run_compression(roaring_bitmap_t *r) { bool answer = false; - for (int i = 0; i < r->high_low_container.size; i++) { + int i = 0; for (i = 0; i < r->high_low_container.size; i++) { uint8_t type_original, type_after; container_t *c = ra_get_container_at_index(&r->high_low_container, i, &type_original); @@ -9655,7 +9659,7 @@ static bool roaring_iterate(const roaring_bitmap_t *r, roaring_iterator iterator void *ptr) { const roaring_array_t *ra = &r->high_low_container; - for (int i = 0; i < ra->size; ++i) + int i = 0; for (i = 0; i < ra->size; ++i) if (!container_iterate(ra->containers[i], ra->typecodes[i], ((uint32_t)ra->keys[i]) << 16, iterator, ptr)) { @@ -9668,7 +9672,7 @@ static bool roaring_iterate64(const roaring_bitmap_t *r, roaring_iterator64 iter uint64_t high_bits, void *ptr) { const roaring_array_t *ra = &r->high_low_container; - for (int i = 0; i < ra->size; ++i) + int i = 0; for (i = 0; i < ra->size; ++i) if (!container_iterate64( ra->containers[i], ra->typecodes[i], ((uint32_t)ra->keys[i]) << 16, iterator, @@ -10046,7 +10050,7 @@ static uint32_t roaring_read_uint32_iterator(roaring_uint32_iterator_t *it, uint case ARRAY_CONTAINER_TYPE: acont = const_CAST_array(it->container); num_values = minimum_uint32(acont->cardinality - it->in_container_index, count - ret); - for (uint32_t i = 0; i < num_values; i++) { + uint32_t i; for (i = 0; i < num_values; i++) { buf[i] = it->highbits | acont->array[it->in_container_index + i]; } buf += num_values; @@ -10063,7 +10067,7 @@ static uint32_t roaring_read_uint32_iterator(roaring_uint32_iterator_t *it, uint do { uint32_t largest_run_value = it->highbits | (rcont->runs[it->run_index].value + rcont->runs[it->run_index].length); num_values = minimum_uint32(largest_run_value - it->current_value + 1, count - ret); - for (uint32_t i = 0; i < num_values; i++) { + uint32_t i; for (i = 0; i < num_values; i++) { buf[i] = it->current_value + i; } it->current_value += num_values; // this can overflow to zero: UINT32_MAX+1=0 @@ -10109,12 +10113,12 @@ static bool roaring_bitmap_equals(const roaring_bitmap_t *r1, if (ra1->size != ra2->size) { return false; } - for (int i = 0; i < ra1->size; ++i) { + int i = 0; for (i = 0; i < ra1->size; ++i) { if (ra1->keys[i] != ra2->keys[i]) { return false; } } - for (int i = 0; i < ra1->size; ++i) { + for (i = 0; i < ra1->size; ++i) { bool areequal = container_equals(ra1->containers[i], ra1->typecodes[i], ra2->containers[i], @@ -10300,7 +10304,7 @@ static roaring_bitmap_t *roaring_bitmap_flip(const roaring_bitmap_t *x1, if (lb_end != 0xFFFF) --hb_end; // later we'll handle the partial block - for (uint32_t hb = hb_start; hb <= hb_end; ++hb) { + uint32_t hb; for (hb = hb_start; hb <= hb_end; ++hb) { insert_fully_flipped_container(&ans->high_low_container, &x1->high_low_container, hb); } @@ -10346,7 +10350,7 @@ static void roaring_bitmap_flip_inplace(roaring_bitmap_t *x1, uint64_t range_sta if (lb_end != 0xFFFF) --hb_end; - for (uint32_t hb = hb_start; hb <= hb_end; ++hb) { + uint32_t hb; for (hb = hb_start; hb <= hb_end; ++hb) { inplace_fully_flip_container(&x1->high_low_container, hb); } // handle a partial final container @@ -10701,7 +10705,7 @@ static void roaring_bitmap_lazy_xor_inplace(roaring_bitmap_t *x1, static void roaring_bitmap_repair_after_lazy(roaring_bitmap_t *r) { roaring_array_t *ra = &r->high_low_container; - for (int i = 0; i < ra->size; ++i) { + int i = 0; for (i = 0; i < ra->size; ++i) { const uint8_t old_type = ra->typecodes[i]; container_t *old_c = ra->containers[i]; uint8_t new_type = old_type; @@ -10720,7 +10724,7 @@ static void roaring_bitmap_repair_after_lazy(roaring_bitmap_t *r) { static uint64_t roaring_bitmap_rank(const roaring_bitmap_t *bm, uint32_t x) { uint64_t size = 0; uint32_t xhigh = x >> 16; - for (int i = 0; i < bm->high_low_container.size; i++) { + int i = 0; for (i = 0; i < bm->high_low_container.size; i++) { uint32_t key = bm->high_low_container.keys[i]; if (xhigh > key) { size += @@ -10960,7 +10964,7 @@ static bool roaring_bitmap_contains_range(const roaring_bitmap_t *r, uint64_t ra if (!container_contains_range(c, 0, lb_re, type)) { return false; } - for (int32_t i = is + 1; i < ie; ++i) { + int32_t i; for (i = is + 1; i < ie; ++i) { c = ra_get_container_at_index(&r->high_low_container, i, &type); if (!container_is_full(c, type) ) { return false; @@ -11010,7 +11014,7 @@ static bool roaring_bitmap_is_strict_subset(const roaring_bitmap_t *r1, static size_t roaring_bitmap_frozen_size_in_bytes(const roaring_bitmap_t *rb) { const roaring_array_t *ra = &rb->high_low_container; size_t num_bytes = 0; - for (int32_t i = 0; i < ra->size; i++) { + int32_t i; for (i = 0; i < ra->size; i++) { switch (ra->typecodes[i]) { case BITSET_CONTAINER_TYPE: { num_bytes += BITSET_CONTAINER_SIZE_IN_WORDS * sizeof(uint64_t); @@ -11053,7 +11057,7 @@ static void roaring_bitmap_frozen_serialize(const roaring_bitmap_t *rb, char *bu size_t bitset_zone_size = 0; size_t run_zone_size = 0; size_t array_zone_size = 0; - for (int32_t i = 0; i < ra->size; i++) { + int32_t i; for (i = 0; i < ra->size; i++) { switch (ra->typecodes[i]) { case BITSET_CONTAINER_TYPE: { bitset_zone_size += @@ -11084,7 +11088,7 @@ static void roaring_bitmap_frozen_serialize(const roaring_bitmap_t *rb, char *bu uint8_t *typecode_zone = (uint8_t *)arena_alloc(&buf, ra->size); uint32_t *header_zone = (uint32_t *)arena_alloc(&buf, 4); - for (int32_t i = 0; i < ra->size; i++) { + for (i = 0; i < ra->size; i++) { uint16_t count; switch (ra->typecodes[i]) { case BITSET_CONTAINER_TYPE: { @@ -11160,7 +11164,7 @@ roaring_bitmap_frozen_view(const char *buf, size_t length) { size_t bitset_zone_size = 0; size_t run_zone_size = 0; size_t array_zone_size = 0; - for (int32_t i = 0; i < num_containers; i++) { + int32_t i; for (i = 0; i < num_containers; i++) { switch (typecodes[i]) { case BITSET_CONTAINER_TYPE: num_bitset_containers++; @@ -11208,7 +11212,7 @@ roaring_bitmap_frozen_view(const char *buf, size_t length) { rb->high_low_container.containers = (container_t **)arena_alloc(&arena, sizeof(container_t*) * num_containers); - for (int32_t i = 0; i < num_containers; i++) { + for (i = 0; i < num_containers; i++) { switch (typecodes[i]) { case BITSET_CONTAINER_TYPE: { bitset_container_t *bitset = (bitset_container_t *) @@ -12766,7 +12770,7 @@ CROARING_UNTARGET_REGION // could be avoided? static inline uint32_t unique(uint16_t *out, uint32_t len) { uint32_t pos = 1; - for (uint32_t i = 1; i < len; ++i) { + uint32_t i; for (i = 1; i < len; ++i) { if (out[i] != out[i - 1]) { out[pos++] = out[i]; } @@ -12896,7 +12900,7 @@ CROARING_UNTARGET_REGION // could be avoided? Warning: assumes len > 0 static inline uint32_t unique_xor(uint16_t *out, uint32_t len) { uint32_t pos = 1; - for (uint32_t i = 1; i < len; ++i) { + uint32_t i; for (i = 1; i < len; ++i) { if (out[i] != out[i - 1]) { out[pos++] = out[i]; } else @@ -13267,7 +13271,7 @@ static array_container_t * array_container_create_range(uint32_t min, uint32_t m array_container_t * answer = array_container_create_given_capacity(max - min + 1); if(answer == NULL) return answer; answer->cardinality = 0; - for(uint32_t k = min; k < max; k++) { + uint32_t k; for(k = min; k < max; k++) { answer->array[answer->cardinality++] = k; } return answer; @@ -13365,7 +13369,7 @@ static void array_container_copy(const array_container_t *src, static void array_container_add_from_range(array_container_t *arr, uint32_t min, uint32_t max, uint16_t step) { - for (uint32_t value = min; value < max; value += step) { + uint32_t value; for (value = min; value < max; value += step) { array_container_append(arr, value); } } @@ -13560,7 +13564,7 @@ static int array_container_to_uint32_array(void *vout, const array_container_t * uint32_t base) { int outpos = 0; uint32_t *out = (uint32_t *)vout; - for (int i = 0; i < cont->cardinality; ++i) { + int i = 0; for (i = 0; i < cont->cardinality; ++i) { const uint32_t val = base + cont->array[i]; memcpy(out + outpos, &val, sizeof(uint32_t)); // should be compiled as a MOV on x64 @@ -13576,7 +13580,7 @@ static void array_container_printf(const array_container_t *v) { } printf("{"); printf("%d", v->array[0]); - for (int i = 1; i < v->cardinality; ++i) { + int i ; for (i = 1; i < v->cardinality; ++i) { printf(",%d", v->array[i]); } printf("}"); @@ -13588,7 +13592,7 @@ static void array_container_printf_as_uint32_array(const array_container_t *v, return; } printf("%u", v->array[0] + base); - for (int i = 1; i < v->cardinality; ++i) { + int i ; for (i = 1; i < v->cardinality; ++i) { printf(",%u", v->array[i] + base); } } @@ -13598,7 +13602,8 @@ static int32_t array_container_number_of_runs(const array_container_t *ac) { // Can SIMD work here? int32_t nr_runs = 0; int32_t prev = -2; - for (const uint16_t *p = ac->array; p != ac->array + ac->cardinality; ++p) { + const uint16_t *p; + for (p = ac->array; p != ac->array + ac->cardinality; ++p) { if (*p != prev + 1) nr_runs++; prev = *p; } @@ -13652,7 +13657,7 @@ static int32_t array_container_read(int32_t cardinality, array_container_t *cont static bool array_container_iterate(const array_container_t *cont, uint32_t base, roaring_iterator iterator, void *ptr) { - for (int i = 0; i < cont->cardinality; i++) + int i = 0; for (i = 0; i < cont->cardinality; i++) if (!iterator(cont->array[i] + base, ptr)) return false; return true; } @@ -13660,7 +13665,7 @@ static bool array_container_iterate(const array_container_t *cont, uint32_t base static bool array_container_iterate64(const array_container_t *cont, uint32_t base, roaring_iterator64 iterator, uint64_t high_bits, void *ptr) { - for (int i = 0; i < cont->cardinality; i++) + int i = 0; for (i = 0; i < cont->cardinality; i++) if (!iterator(high_bits | (uint64_t)(cont->array[i] + base), ptr)) return false; return true; @@ -13710,7 +13715,7 @@ static void run_bitset_container_union(const run_container_t *src_1, bitset_container_t *dst) { assert(!run_container_is_full(src_1)); // catch this case upstream if (src_2 != dst) bitset_container_copy(src_2, dst); - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; bitset_set_lenrange(dst->words, rle.value, rle.length); } @@ -13722,7 +13727,7 @@ static void run_bitset_container_lazy_union(const run_container_t *src_1, bitset_container_t *dst) { assert(!run_container_is_full(src_1)); // catch this case upstream if (src_2 != dst) bitset_container_copy(src_2, dst); - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; bitset_set_lenrange(dst->words, rle.value, rle.length); } @@ -13982,14 +13987,14 @@ extern "C" { namespace roaring { namespace internal { static bitset_container_t *bitset_container_from_array(const array_container_t *ac) { bitset_container_t *ans = bitset_container_create(); int limit = array_container_cardinality(ac); - for (int i = 0; i < limit; ++i) bitset_container_set(ans, ac->array[i]); + int i = 0; for (i = 0; i < limit; ++i) bitset_container_set(ans, ac->array[i]); return ans; } static bitset_container_t *bitset_container_from_run(const run_container_t *arr) { int card = run_container_cardinality(arr); bitset_container_t *answer = bitset_container_create(); - for (int rlepos = 0; rlepos < arr->n_runs; ++rlepos) { + int rlepos; for (rlepos = 0; rlepos < arr->n_runs; ++rlepos) { rle16_t vl = arr->runs[rlepos]; bitset_set_lenrange(answer->words, vl.value, vl.length); } @@ -14001,11 +14006,11 @@ static array_container_t *array_container_from_run(const run_container_t *arr) { array_container_t *answer = array_container_create_given_capacity(run_container_cardinality(arr)); answer->cardinality = 0; - for (int rlepos = 0; rlepos < arr->n_runs; ++rlepos) { + int rlepos; for (rlepos = 0; rlepos < arr->n_runs; ++rlepos) { int run_start = arr->runs[rlepos].value; int run_end = run_start + arr->runs[rlepos].length; - for (int run_value = run_start; run_value <= run_end; ++run_value) { + int run_value; for (run_value = run_start; run_value <= run_end; ++run_value) { answer->array[answer->cardinality++] = (uint16_t)run_value; } } @@ -14038,7 +14043,7 @@ static run_container_t *run_container_from_array(const array_container_t *c) { int run_start = -1; int32_t card = c->cardinality; if (card == 0) return answer; - for (int i = 0; i < card; ++i) { + int i = 0; for (i = 0; i < card; ++i) { const uint16_t cur_val = c->array[i]; if (cur_val != prev + 1) { // new run starts; flush old one, if any @@ -14066,10 +14071,10 @@ static container_t *convert_to_bitset_or_array_container( if (card <= DEFAULT_MAX_SIZE) { array_container_t *answer = array_container_create_given_capacity(card); answer->cardinality = 0; - for (int rlepos = 0; rlepos < rc->n_runs; ++rlepos) { + int rlepos; for (rlepos = 0; rlepos < rc->n_runs; ++rlepos) { uint16_t run_start = rc->runs[rlepos].value; uint16_t run_end = run_start + rc->runs[rlepos].length; - for (uint16_t run_value = run_start; run_value <= run_end; + uint16_t run_value; for (run_value = run_start; run_value <= run_end; ++run_value) { answer->array[answer->cardinality++] = run_value; } @@ -14080,7 +14085,7 @@ static container_t *convert_to_bitset_or_array_container( return answer; } bitset_container_t *answer = bitset_container_create(); - for (int rlepos = 0; rlepos < rc->n_runs; ++rlepos) { + int rlepos; for (rlepos = 0; rlepos < rc->n_runs; ++rlepos) { uint16_t run_start = rc->runs[rlepos].value; bitset_set_lenrange(answer->words, run_start, rc->runs[rlepos].length); } @@ -14120,11 +14125,11 @@ static container_t *convert_run_to_efficient_container( // to array array_container_t *answer = array_container_create_given_capacity(card); answer->cardinality = 0; - for (int rlepos = 0; rlepos < c->n_runs; ++rlepos) { + int rlepos; for (rlepos = 0; rlepos < c->n_runs; ++rlepos) { int run_start = c->runs[rlepos].value; int run_end = run_start + c->runs[rlepos].length; - for (int run_value = run_start; run_value <= run_end; ++run_value) { + int run_value; for (run_value = run_start; run_value <= run_end; ++run_value) { answer->array[answer->cardinality++] = (uint16_t)run_value; } } @@ -14135,7 +14140,7 @@ static container_t *convert_run_to_efficient_container( // else to bitset bitset_container_t *answer = bitset_container_create(); - for (int rlepos = 0; rlepos < c->n_runs; ++rlepos) { + int rlepos; for (rlepos = 0; rlepos < c->n_runs; ++rlepos) { int start = c->runs[rlepos].value; int end = start + c->runs[rlepos].length; bitset_set_range(answer->words, start, end + 1); @@ -14193,7 +14198,7 @@ static container_t *convert_run_optimize( int run_start = -1; assert(card > 0); - for (int i = 0; i < card; ++i) { + int i = 0; for (i = 0; i < card; ++i) { uint16_t cur_val = c_qua_array->array[i]; if (cur_val != prev + 1) { // new run starts; flush old one, if any @@ -14280,7 +14285,7 @@ static container_t *container_from_run_range( bitset_container_t *bitset = bitset_container_create(); *typecode_after = BITSET_CONTAINER_TYPE; int32_t union_cardinality = 0; - for (int32_t i = 0; i < run->n_runs; ++i) { + int32_t i; for (i = 0; i < run->n_runs; ++i) { uint32_t rle_min = run->runs[i].value; uint32_t rle_max = rle_min + run->runs[i].length; bitset_set_lenrange(bitset->words, rle_min, rle_max - rle_min); @@ -14877,10 +14882,10 @@ static int run_container_to_uint32_array(void *vout, const run_container_t *cont uint32_t base) { int outpos = 0; uint32_t *out = (uint32_t *)vout; - for (int i = 0; i < cont->n_runs; ++i) { + int i = 0; for (i = 0; i < cont->n_runs; ++i) { uint32_t run_start = base + cont->runs[i].value; uint16_t le = cont->runs[i].length; - for (int j = 0; j <= le; ++j) { + int j; for (j = 0; j <= le; ++j) { uint32_t val = run_start + j; memcpy(out + outpos, &val, sizeof(uint32_t)); // should be compiled as a MOV on x64 @@ -14894,7 +14899,7 @@ static int run_container_to_uint32_array(void *vout, const run_container_t *cont * Print this container using printf (useful for debugging). */ static void run_container_printf(const run_container_t *cont) { - for (int i = 0; i < cont->n_runs; ++i) { + int i = 0; for (i = 0; i < cont->n_runs; ++i) { uint16_t run_start = cont->runs[i].value; uint16_t le = cont->runs[i].length; printf("[%d,%d]", run_start, run_start + le); @@ -14912,12 +14917,12 @@ static void run_container_printf_as_uint32_array(const run_container_t *cont, uint32_t run_start = base + cont->runs[0].value; uint16_t le = cont->runs[0].length; printf("%u", run_start); - for (uint32_t j = 1; j <= le; ++j) printf(",%u", run_start + j); + uint32_t j; for (j = 1; j <= le; ++j) printf(",%u", run_start + j); } - for (int32_t i = 1; i < cont->n_runs; ++i) { + int32_t i; for (i = 1; i < cont->n_runs; ++i) { uint32_t run_start = base + cont->runs[i].value; uint16_t le = cont->runs[i].length; - for (uint32_t j = 0; j <= le; ++j) printf(",%u", run_start + j); + uint32_t j; for (j = 0; j <= le; ++j) printf(",%u", run_start + j); } } @@ -14943,11 +14948,11 @@ static int32_t run_container_read(int32_t cardinality, run_container_t *containe static bool run_container_iterate(const run_container_t *cont, uint32_t base, roaring_iterator iterator, void *ptr) { - for (int i = 0; i < cont->n_runs; ++i) { + int i = 0; for (i = 0; i < cont->n_runs; ++i) { uint32_t run_start = base + cont->runs[i].value; uint16_t le = cont->runs[i].length; - for (int j = 0; j <= le; ++j) + int j; for (j = 0; j <= le; ++j) if (!iterator(run_start + j, ptr)) return false; } return true; @@ -14956,11 +14961,11 @@ static bool run_container_iterate(const run_container_t *cont, uint32_t base, static bool run_container_iterate64(const run_container_t *cont, uint32_t base, roaring_iterator64 iterator, uint64_t high_bits, void *ptr) { - for (int i = 0; i < cont->n_runs; ++i) { + int i = 0; for (i = 0; i < cont->n_runs; ++i) { uint32_t run_start = base + cont->runs[i].value; uint16_t le = cont->runs[i].length; - for (int j = 0; j <= le; ++j) + int j; for (j = 0; j <= le; ++j) if (!iterator(high_bits | (uint64_t)(run_start + j), ptr)) return false; } @@ -15046,7 +15051,7 @@ static void run_container_smart_append_exclusive(run_container_t *src, static bool run_container_select(const run_container_t *container, uint32_t *start_rank, uint32_t rank, uint32_t *element) { - for (int i = 0; i < container->n_runs; i++) { + int i = 0; for (i = 0; i < container->n_runs; i++) { uint16_t length = container->runs[i].length; if (rank <= *start_rank + length) { uint16_t value = container->runs[i].value; @@ -15061,7 +15066,7 @@ static bool run_container_select(const run_container_t *container, static int run_container_rank(const run_container_t *container, uint16_t x) { int sum = 0; uint32_t x32 = x; - for (int i = 0; i < container->n_runs; i++) { + int i = 0; for (i = 0; i < container->n_runs; i++) { uint32_t startpoint = container->runs[i].value; uint32_t length = container->runs[i].length; uint32_t endpoint = length + startpoint; @@ -15139,7 +15144,7 @@ static int run_container_cardinality(const run_container_t *run) { /* by initializing with n_runs, we omit counting the +1 for each pair. */ int sum = n_runs; - for (int k = 0; k < n_runs; ++k) { + int k; for (k = 0; k < n_runs; ++k) { sum += runs[k].length; } @@ -15435,7 +15440,7 @@ static void array_bitset_container_andnot(const array_container_t *src_1, } int32_t newcard = 0; const int32_t origcard = src_1->cardinality; - for (int i = 0; i < origcard; ++i) { + int i = 0; for (i = 0; i < origcard; ++i) { uint16_t key = src_1->array[i]; dst->array[newcard] = key; newcard += 1 - bitset_container_contains(src_2, key); @@ -15518,9 +15523,9 @@ static bool run_bitset_container_andnot( // must be an array array_container_t *answer = array_container_create_given_capacity(card); answer->cardinality = 0; - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; - for (int run_value = rle.value; run_value <= rle.value + rle.length; + int run_value; for (run_value = rle.value; run_value <= rle.value + rle.length; ++run_value) { if (!bitset_container_get(src_2, (uint16_t)run_value)) { answer->array[answer->cardinality++] = (uint16_t)run_value; @@ -15534,7 +15539,7 @@ static bool run_bitset_container_andnot( bitset_container_t *answer = bitset_container_clone(src_2); uint32_t last_pos = 0; - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; uint32_t start = rle.value; @@ -15589,7 +15594,7 @@ static bool bitset_run_container_andnot( bitset_container_t *result = bitset_container_create(); bitset_container_copy(src_1, result); - for (int32_t rlepos = 0; rlepos < src_2->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_2->n_runs; ++rlepos) { rle16_t rle = src_2->runs[rlepos]; bitset_reset_range(result->words, rle.value, rle.value + rle.length + UINT32_C(1)); @@ -15618,7 +15623,7 @@ static bool bitset_run_container_iandnot( ){ *dst = src_1; - for (int32_t rlepos = 0; rlepos < src_2->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_2->n_runs; ++rlepos) { rle16_t rle = src_2->runs[rlepos]; bitset_reset_range(src_1->words, rle.value, rle.value + rle.length + UINT32_C(1)); @@ -15648,7 +15653,7 @@ static int run_array_array_subtract(const run_container_t *rc, int32_t in_array_pos = -1; // since advanceUntil always assumes we start the search AFTER this - for (int rlepos = 0; rlepos < rc->n_runs; rlepos++) { + int rlepos; for (rlepos = 0; rlepos < rc->n_runs; rlepos++) { int32_t start = rc->runs[rlepos].value; int32_t end = start + rc->runs[rlepos].length + 1; @@ -15656,17 +15661,17 @@ static int run_array_array_subtract(const run_container_t *rc, a_in->cardinality, (uint16_t)start); if (in_array_pos >= a_in->cardinality) { // run has no items subtracted - for (int32_t i = start; i < end; ++i) + int32_t i; for (i = start; i < end; ++i) a_out->array[out_card++] = (uint16_t)i; } else { uint16_t next_nonincluded = a_in->array[in_array_pos]; if (next_nonincluded >= end) { // another case when run goes unaltered - for (int32_t i = start; i < end; ++i) + int32_t i; for (i = start; i < end; ++i) a_out->array[out_card++] = (uint16_t)i; in_array_pos--; // ensure we see this item again if necessary } else { - for (int32_t i = start; i < end; ++i) + int32_t i; for (i = start; i < end; ++i) if (i != next_nonincluded) a_out->array[out_card++] = (uint16_t)i; else // 0 should ensure we don't match @@ -15811,7 +15816,7 @@ static void array_run_container_andnot(const array_container_t *src_1, uint16_t val = 0; int dest_card = 0; - for (int i = 0; i < src_1->cardinality; ++i) { + int i = 0; for (i = 0; i < src_1->cardinality; ++i) { val = src_1->array[i]; if (val < run_start) dst->array[dest_card++] = val; @@ -16309,7 +16314,7 @@ static bool array_container_equal_bitset(const array_container_t* container1, } } int32_t pos = 0; - for (int32_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i) { + int32_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i) { uint64_t w = container2->words[i]; while (w != 0) { uint64_t t = w & (~w + 1); @@ -16332,7 +16337,7 @@ static bool run_container_equals_array(const run_container_t* container1, if (run_container_cardinality(container1) != container2->cardinality) return false; int32_t pos = 0; - for (int i = 0; i < container1->n_runs; ++i) { + int i = 0; for (i = 0; i < container1->n_runs; ++i) { const uint32_t run_start = container1->runs[i].value; const uint32_t le = container1->runs[i].length; @@ -16360,7 +16365,7 @@ static bool run_container_equals_bitset(const run_container_t* container1, return false; } - for (int32_t i = 0; i < container1->n_runs; i++) { + int32_t i; for (i = 0; i < container1->n_runs; i++) { uint32_t begin = container1->runs[i].value; if (container1->runs[i].length) { uint32_t end = begin + container1->runs[i].length + 1; @@ -16456,7 +16461,7 @@ static void bitset_container_add_from_range(bitset_container_t *bitset, uint32_t if (step == 0) return; // refuse to crash if ((64 % step) == 0) { // step divides 64 uint64_t mask = 0; // construct the repeated mask - for (uint32_t value = (min % step); value < 64; value += step) { + uint32_t value; for (value = (min % step); value < 64; value += step) { mask |= ((uint64_t)1 << value); } uint32_t firstword = min / 64; @@ -16469,11 +16474,11 @@ static void bitset_container_add_from_range(bitset_container_t *bitset, uint32_t return; } bitset->words[firstword] = mask & ((~UINT64_C(0)) << (min % 64)); - for (uint32_t i = firstword + 1; i < endword; i++) + uint32_t i; for (i = firstword + 1; i < endword; i++) bitset->words[i] = mask; bitset->words[endword] = mask & ((~UINT64_C(0)) >> ((~max + 1) % 64)); } else { - for (uint32_t value = min; value < max; value += step) { + uint32_t value; for (value = min; value < max; value += step) { bitset_container_add(bitset, value); } } @@ -16522,7 +16527,7 @@ static bool bitset_container_intersect(const bitset_container_t *src_1, // could vectorize, but this is probably already quite fast in practice const uint64_t * __restrict__ words_1 = src_1->words; const uint64_t * __restrict__ words_2 = src_2->words; - for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i ++) { + int i = 0; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i ++) { if((words_1[i] & words_2[i]) != 0) return true; } return false; @@ -16537,7 +16542,7 @@ static bool bitset_container_intersect(const bitset_container_t *src_1, static inline int _scalar_bitset_container_compute_cardinality(const bitset_container_t *bitset) { const uint64_t *words = bitset->words; int32_t sum = 0; - for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 4) { + int i = 0; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 4) { sum += hamming(words[i]); sum += hamming(words[i + 1]); sum += hamming(words[i + 2]); @@ -16563,7 +16568,7 @@ static int bitset_container_compute_cardinality(const bitset_container_t *bitset uint16x8_t n1 = vdupq_n_u16(0); uint16x8_t n2 = vdupq_n_u16(0); uint16x8_t n3 = vdupq_n_u16(0); - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 8) { + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 8) { uint64x2_t c0 = vld1q_u64(&bitset->words[i + 0]); n0 = vaddq_u16(n0, vpaddlq_u8(vcntq_u8(vreinterpretq_u8_u64(c0)))); uint64x2_t c1 = vld1q_u64(&bitset->words[i + 2]); @@ -16587,7 +16592,7 @@ static int bitset_container_compute_cardinality(const bitset_container_t *bitset static int bitset_container_compute_cardinality(const bitset_container_t *bitset) { const uint64_t *words = bitset->words; int32_t sum = 0; - for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 4) { + int i = 0; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 4) { sum += hamming(words[i]); sum += hamming(words[i + 1]); sum += hamming(words[i + 2]); @@ -16621,7 +16626,7 @@ static int bitset_container_compute_cardinality(const bitset_container_t *bitset /* not using the blocking optimization for some reason*/ \ uint8_t *out = (uint8_t *)dst->words; \ const int innerloop = 8; \ - for (size_t i = 0; \ + size_t i; for (i = 0; \ i < BITSET_CONTAINER_SIZE_IN_WORDS / (WORDS_IN_AVX2_REG); \ i += innerloop) { \ __m256i A1, A2, AO; \ @@ -16771,7 +16776,7 @@ CROARING_UNTARGET_REGION const uint64_t *__restrict__ words_2 = src_2->words; \ uint64_t *out = dst->words; \ int32_t sum = 0; \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \ const uint64_t word_1 = (words_1[i])opsymbol(words_2[i]), \ word_2 = (words_1[i + 1]) opsymbol(words_2[i + 1]); \ out[i] = word_1; \ @@ -16788,7 +16793,7 @@ CROARING_UNTARGET_REGION const uint64_t *__restrict__ words_1 = src_1->words; \ const uint64_t *__restrict__ words_2 = src_2->words; \ uint64_t *out = dst->words; \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i++) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i++) { \ out[i] = (words_1[i])opsymbol(words_2[i]); \ } \ dst->cardinality = BITSET_UNKNOWN_CARDINALITY; \ @@ -16799,7 +16804,7 @@ CROARING_UNTARGET_REGION const uint64_t *__restrict__ words_1 = src_1->words; \ const uint64_t *__restrict__ words_2 = src_2->words; \ int32_t sum = 0; \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \ const uint64_t word_1 = (words_1[i])opsymbol(words_2[i]), \ word_2 = (words_1[i + 1]) opsymbol(words_2[i + 1]); \ sum += hamming(word_1); \ @@ -16864,7 +16869,7 @@ static int bitset_container_##opname(const bitset_container_t *src_1, uint16x8_t n1 = vdupq_n_u16(0); \ uint16x8_t n2 = vdupq_n_u16(0); \ uint16x8_t n3 = vdupq_n_u16(0); \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 8) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 8) { \ uint64x2_t c0 = neon_intrinsic(vld1q_u64(&words_1[i + 0]), \ vld1q_u64(&words_2[i + 0])); \ n0 = vaddq_u16(n0, vpaddlq_u8(vcntq_u8(vreinterpretq_u8_u64(c0)))); \ @@ -16896,7 +16901,7 @@ static int bitset_container_##opname##_nocard(const bitset_container_t *src_1, const uint64_t * __restrict__ words_1 = src_1->words; \ const uint64_t * __restrict__ words_2 = src_2->words; \ uint64_t *out = dst->words; \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 8) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 8) { \ vst1q_u64(&out[i + 0], neon_intrinsic(vld1q_u64(&words_1[i + 0]), \ vld1q_u64(&words_2[i + 0]))); \ vst1q_u64(&out[i + 2], neon_intrinsic(vld1q_u64(&words_1[i + 2]), \ @@ -16917,7 +16922,7 @@ static int bitset_container_##opname##_justcard(const bitset_container_t *src_1, uint16x8_t n1 = vdupq_n_u16(0); \ uint16x8_t n2 = vdupq_n_u16(0); \ uint16x8_t n3 = vdupq_n_u16(0); \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 8) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 8) { \ uint64x2_t c0 = neon_intrinsic(vld1q_u64(&words_1[i + 0]), \ vld1q_u64(&words_2[i + 0])); \ n0 = vaddq_u16(n0, vpaddlq_u8(vcntq_u8(vreinterpretq_u8_u64(c0)))); \ @@ -16949,7 +16954,7 @@ static int bitset_container_##opname(const bitset_container_t *src_1, const uint64_t * __restrict__ words_2 = src_2->words; \ uint64_t *out = dst->words; \ int32_t sum = 0; \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \ const uint64_t word_1 = (words_1[i])opsymbol(words_2[i]), \ word_2 = (words_1[i + 1])opsymbol(words_2[i + 1]); \ out[i] = word_1; \ @@ -16966,7 +16971,7 @@ static int bitset_container_##opname##_nocard(const bitset_container_t *src_1, const uint64_t * __restrict__ words_1 = src_1->words; \ const uint64_t * __restrict__ words_2 = src_2->words; \ uint64_t *out = dst->words; \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i++) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i++) { \ out[i] = (words_1[i])opsymbol(words_2[i]); \ } \ dst->cardinality = BITSET_UNKNOWN_CARDINALITY; \ @@ -16977,7 +16982,7 @@ static int bitset_container_##opname##_justcard(const bitset_container_t *src_1, const uint64_t * __restrict__ words_1 = src_1->words; \ const uint64_t * __restrict__ words_2 = src_2->words; \ int32_t sum = 0; \ - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \ + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \ const uint64_t word_1 = (words_1[i])opsymbol(words_2[i]), \ word_2 = (words_1[i + 1])opsymbol(words_2[i + 1]); \ sum += hamming(word_1); \ @@ -17026,7 +17031,7 @@ static void bitset_container_printf(const bitset_container_t * v) { printf("{"); uint32_t base = 0; bool iamfirst = true;// TODO: rework so that this is not necessary yet still readable - for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i) { + int i = 0; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i) { uint64_t w = v->words[i]; while (w != 0) { uint64_t t = w & (~w + 1); @@ -17050,7 +17055,7 @@ static void bitset_container_printf(const bitset_container_t * v) { */ static void bitset_container_printf_as_uint32_array(const bitset_container_t * v, uint32_t base) { bool iamfirst = true;// TODO: rework so that this is not necessary yet still readable - for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i) { + int i = 0; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i) { uint64_t w = v->words[i]; while (w != 0) { uint64_t t = w & (~w + 1); @@ -17073,7 +17078,7 @@ static int bitset_container_number_of_runs(bitset_container_t *bc) { int num_runs = 0; uint64_t next_word = bc->words[0]; - for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS-1; ++i) { + int i = 0; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS-1; ++i) { uint64_t word = next_word; next_word = bc->words[i+1]; num_runs += hamming((~word) & (word << 1)) + ( (word >> 63) & ~next_word); @@ -17102,7 +17107,7 @@ static int32_t bitset_container_read(int32_t cardinality, bitset_container_t *co } static bool bitset_container_iterate(const bitset_container_t *cont, uint32_t base, roaring_iterator iterator, void *ptr) { - for (int32_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i ) { + int32_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i ) { uint64_t w = cont->words[i]; while (w != 0) { uint64_t t = w & (~w + 1); @@ -17116,7 +17121,7 @@ static bool bitset_container_iterate(const bitset_container_t *cont, uint32_t ba } static bool bitset_container_iterate64(const bitset_container_t *cont, uint32_t base, roaring_iterator64 iterator, uint64_t high_bits, void *ptr) { - for (int32_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i ) { + int32_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i ) { uint64_t w = cont->words[i]; while (w != 0) { uint64_t t = w & (~w + 1); @@ -17134,7 +17139,7 @@ CROARING_TARGET_AVX2 static inline bool _avx2_bitset_container_equals(const bitset_container_t *container1, const bitset_container_t *container2) { const __m256i *ptr1 = (const __m256i*)container1->words; const __m256i *ptr2 = (const __m256i*)container2->words; - for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS*sizeof(uint64_t)/32; i++) { + size_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS*sizeof(uint64_t)/32; i++) { __m256i r1 = _mm256_load_si256(ptr1+i); __m256i r2 = _mm256_load_si256(ptr2+i); int mask = _mm256_movemask_epi8(_mm256_cmpeq_epi8(r1, r2)); @@ -17173,7 +17178,7 @@ static bool bitset_container_is_subset(const bitset_container_t *container1, return false; } } - for(int32_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i ) { + int32_t i ; for(i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i ) { if((container1->words[i] & container2->words[i]) != container1->words[i]) { return false; } @@ -17189,7 +17194,7 @@ static bool bitset_container_select(const bitset_container_t *container, uint32_ } const uint64_t *words = container->words; int32_t size; - for (int i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 1) { + int i = 0; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 1) { size = hamming(words[i]); if(rank <= *start_rank + size) { uint64_t w = container->words[i]; @@ -17215,7 +17220,7 @@ static bool bitset_container_select(const bitset_container_t *container, uint32_ /* Returns the smallest value (assumes not empty) */ static uint16_t bitset_container_minimum(const bitset_container_t *container) { - for (int32_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i ) { + int32_t i; for (i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; ++i ) { uint64_t w = container->words[i]; if (w != 0) { int r = __builtin_ctzll(w); @@ -17227,7 +17232,7 @@ static uint16_t bitset_container_minimum(const bitset_container_t *container) { /* Returns the largest value (assumes not empty) */ static uint16_t bitset_container_maximum(const bitset_container_t *container) { - for (int32_t i = BITSET_CONTAINER_SIZE_IN_WORDS - 1; i > 0; --i ) { + int32_t i; for (i = BITSET_CONTAINER_SIZE_IN_WORDS - 1; i > 0; --i ) { uint64_t w = container->words[i]; if (w != 0) { int r = __builtin_clzll(w); @@ -17241,8 +17246,8 @@ static uint16_t bitset_container_maximum(const bitset_container_t *container) { static int bitset_container_rank(const bitset_container_t *container, uint16_t x) { // credit: aqrit int sum = 0; - int i = 0; - for (int end = x / 64; i < end; i++){ + int i = 0, end; + for (end = x / 64; i < end; i++){ sum += hamming(container->words[i]); } uint64_t lastword = container->words[i]; @@ -17292,7 +17297,7 @@ static void array_bitset_container_intersection(const array_container_t *src_1, } int32_t newcard = 0; // dst could be src_1 const int32_t origcard = src_1->cardinality; - for (int i = 0; i < origcard; ++i) { + int i = 0; for (i = 0; i < origcard; ++i) { uint16_t key = src_1->array[i]; // this branchless approach is much faster... dst->array[newcard] = key; @@ -17318,7 +17323,7 @@ static int array_bitset_container_intersection_cardinality( const array_container_t *src_1, const bitset_container_t *src_2) { int32_t newcard = 0; const int32_t origcard = src_1->cardinality; - for (int i = 0; i < origcard; ++i) { + int i = 0; for (i = 0; i < origcard; ++i) { uint16_t key = src_1->array[i]; newcard += bitset_container_contains(src_2, key); } @@ -17329,7 +17334,7 @@ static int array_bitset_container_intersection_cardinality( static bool array_bitset_container_intersect(const array_container_t *src_1, const bitset_container_t *src_2) { const int32_t origcard = src_1->cardinality; - for (int i = 0; i < origcard; ++i) { + int i = 0; for (i = 0; i < origcard; ++i) { uint16_t key = src_1->array[i]; if(bitset_container_contains(src_2, key)) return true; } @@ -17403,10 +17408,10 @@ static bool run_bitset_container_intersection( if (*dst == NULL) { return false; } - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; - uint32_t endofrun = (uint32_t)rle.value + rle.length; - for (uint32_t runValue = rle.value; runValue <= endofrun; + uint32_t endofrun = (uint32_t)rle.value + rle.length, runValue; + for (runValue = rle.value; runValue <= endofrun; ++runValue) { answer->array[answer->cardinality] = (uint16_t)runValue; answer->cardinality += @@ -17418,7 +17423,7 @@ static bool run_bitset_container_intersection( if (*dst == src_2) { // we attempt in-place bitset_container_t *answer = CAST_bitset(*dst); uint32_t start = 0; - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { const rle16_t rle = src_1->runs[rlepos]; uint32_t end = rle.value; bitset_reset_range(src_2->words, start, end); @@ -17447,7 +17452,7 @@ static bool run_bitset_container_intersection( return true; } uint32_t start = 0; - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { const rle16_t rle = src_1->runs[rlepos]; uint32_t end = rle.value; bitset_reset_range(answer->words, start, end); @@ -17513,7 +17518,7 @@ static int run_bitset_container_intersection_cardinality( return bitset_container_cardinality(src_2); } int answer = 0; - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; answer += bitset_lenrange_cardinality(src_2->words, rle.value, rle.length); @@ -17560,7 +17565,7 @@ static bool run_bitset_container_intersect(const run_container_t *src_1, if( run_container_is_full(src_1) ) { return !bitset_container_empty(src_2); } - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; if(!bitset_lenrange_empty(src_2->words, rle.value,rle.length)) return true; } @@ -17633,7 +17638,7 @@ static bool array_container_is_subset_bitset(const array_container_t* container1 return false; } } - for (int i = 0; i < container1->cardinality; ++i) { + int i = 0; for (i = 0; i < container1->cardinality; ++i) { if (!bitset_container_contains(container2, container1->array[i])) { return false; } @@ -17646,7 +17651,7 @@ static bool run_container_is_subset_array(const run_container_t* container1, if (run_container_cardinality(container1) > container2->cardinality) return false; int32_t start_pos = -1, stop_pos = -1; - for (int i = 0; i < container1->n_runs; ++i) { + int i = 0; for (i = 0; i < container1->n_runs; ++i) { int32_t start = container1->runs[i].value; int32_t stop = start + container1->runs[i].length; start_pos = advanceUntil(container2->array, stop_pos, @@ -17701,10 +17706,10 @@ static bool run_container_is_subset_bitset(const run_container_t* container1, return false; } } - for (int i = 0; i < container1->n_runs; ++i) { + int i = 0; for (i = 0; i < container1->n_runs; ++i) { uint32_t run_start = container1->runs[i].value; uint32_t le = container1->runs[i].length; - for (uint32_t j = run_start; j <= run_start + le; ++j) { + uint32_t j; for (j = run_start; j <= run_start + le; ++j) { if (!bitset_container_contains(container2, j)) { return false; } @@ -17823,7 +17828,7 @@ static bool run_bitset_container_xor( bitset_container_t *result = bitset_container_create(); bitset_container_copy(src_2, result); - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; bitset_flip_range(result->words, rle.value, rle.value + rle.length + UINT32_C(1)); @@ -17848,7 +17853,7 @@ static void run_bitset_container_lazy_xor(const run_container_t *src_1, const bitset_container_t *src_2, bitset_container_t *dst) { if (src_2 != dst) bitset_container_copy(src_2, dst); - for (int32_t rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { + int32_t rlepos; for (rlepos = 0; rlepos < src_1->n_runs; ++rlepos) { rle16_t rle = src_1->runs[rlepos]; bitset_flip_range(dst->words, rle.value, rle.value + rle.length + UINT32_C(1)); @@ -18755,7 +18760,7 @@ CROARING_UNTARGET_REGION size_t bitset_extract_setbits(const uint64_t *words, size_t length, uint32_t *out, uint32_t base) { int outpos = 0; - for (size_t i = 0; i < length; ++i) { + size_t i; for (i = 0; i < length; ++i) { uint64_t w = words[i]; while (w != 0) { uint64_t t = w & (~w + 1); // on x64, should compile to BLSI (careful: the Intel compiler seems to fail) @@ -18776,7 +18781,7 @@ size_t bitset_extract_intersection_setbits_uint16(const uint64_t * __restrict__ size_t length, uint16_t *out, uint16_t base) { int outpos = 0; - for (size_t i = 0; i < length; ++i) { + size_t i; for (i = 0; i < length; ++i) { uint64_t w = words1[i] & words2[i]; while (w != 0) { uint64_t t = w & (~w + 1); @@ -18868,7 +18873,7 @@ CROARING_UNTARGET_REGION static size_t bitset_extract_setbits_uint16(const uint64_t *words, size_t length, uint16_t *out, uint16_t base) { int outpos = 0; - for (size_t i = 0; i < length; ++i) { + size_t i; for (i = 0; i < length; ++i) { uint64_t w = words[i]; while (w != 0) { uint64_t t = w & (~w + 1); |