Commit 091c30c7 authored by Andreas Seltenreich's avatar Andreas Seltenreich
Browse files

Fix bogus use of BITSET_ELEM in rbitset_set_range().

parent cf3d7fb8
...@@ -432,24 +432,24 @@ static inline void rbitset_set_range(unsigned *bitset, size_t from, ...@@ -432,24 +432,24 @@ static inline void rbitset_set_range(unsigned *bitset, size_t from,
/* do we want to set the bits in the range? */ /* do we want to set the bits in the range? */
if (val) { if (val) {
if (from_pos == to_pos) { if (from_pos == to_pos) {
BITSET_ELEM(bitset, from_pos) |= from_unit_mask & to_unit_mask; bitset[from_pos] |= from_unit_mask & to_unit_mask;
} else { } else {
size_t i; size_t i;
BITSET_ELEM(bitset, from_pos) |= from_unit_mask; bitset[from_pos] |= from_unit_mask;
BITSET_ELEM(bitset, to_pos) |= to_unit_mask; bitset[to_pos] |= to_unit_mask;
for (i = from_pos + 1; i < to_pos; ++i) for (i = from_pos + 1; i < to_pos; ++i)
BITSET_ELEM(bitset, i) = ~0u; bitset[i] = ~0u;
} }
} else { } else {
/* ... or clear them? */ /* ... or clear them? */
if (from_pos == to_pos) { if (from_pos == to_pos) {
BITSET_ELEM(bitset, from_pos) &= ~(from_unit_mask & to_unit_mask); bitset[from_pos] &= ~(from_unit_mask & to_unit_mask);
} else { } else {
size_t i; size_t i;
BITSET_ELEM(bitset, from_pos) &= ~from_unit_mask; bitset[from_pos] &= ~from_unit_mask;
BITSET_ELEM(bitset, to_pos) &= ~to_unit_mask; bitset[to_pos] &= ~to_unit_mask;
for (i = from_pos + 1; i < to_pos; ++i) for (i = from_pos + 1; i < to_pos; ++i)
BITSET_ELEM(bitset, i) = 0; bitset[i] = 0;
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment