const uint32_t *flow_u32 = (const uint32_t *)flow;
const uint32_t *p = mask_values;
uint32_t hash;
- uint64_t map;
+ int idx;
hash = basis;
- for (map = mask->masks.map; map; map = zero_rightmost_1bit(map)) {
- hash = hash_add(hash, flow_u32[raw_ctz(map)] & *p++);
+ MAP_FOR_EACH_INDEX(idx, mask->masks.map) {
+ hash = hash_add(hash, flow_u32[idx] & *p++);
}
return hash_finish(hash, (p - mask_values) * 4);
&offset);
const uint32_t *p = mask_values + offset;
uint32_t hash = *basis;
+ int idx;
- for (; map; map = zero_rightmost_1bit(map)) {
- hash = hash_add(hash, flow_u32[raw_ctz(map)] & *p++);
+ MAP_FOR_EACH_INDEX(idx, map) {
+ hash = hash_add(hash, flow_u32[idx] & *p++);
}
*basis = hash; /* Allow continuation from the unfinished value. */
uint64_t map = miniflow_get_map_in_range(&mask->masks, start, end,
&offset);
const uint32_t *p = miniflow_get_u32_values(&mask->masks) + offset;
+ int idx;
- for (; map; map = zero_rightmost_1bit(map)) {
- dst_u32[raw_ctz(map)] |= *p++;
+ MAP_FOR_EACH_INDEX(idx, map) {
+ dst_u32[idx] |= *p++;
}
}