Commit 4bdc3989 authored by Dong-hee Na's avatar Dong-hee Na

bitset begin() fix

parent b163e6cd
......@@ -181,9 +181,10 @@ template <int N> struct BitSet {
}
iterator begin() const {
uint16_t tmp = bits;
for (int i = 0; i < N; i++) {
if (tmp & 1)
return iterator(*this, i);
if (tmp > 0) {
int offset = __builtin_ctz(tmp);
if (offset < N)
return iterator(*this, offset);
}
return iterator(*this, N);
}
......
Markdown is supported
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