| 213 | } |
| 214 | |
| 215 | bool BitmapBase::DoFindNext(WordType* words, size_t word_size, size_t prev, size_t* result) |
| 216 | { |
| 217 | // make bound inclusive |
| 218 | ++prev; |
| 219 | |
| 220 | // check out of bounds |
| 221 | if (prev >= word_size * kBitsPerWord) |
| 222 | return false; |
| 223 | |
| 224 | // search first word |
| 225 | size_t i = WordIndexOfBit(prev); |
| 226 | WordType thisword = words[i]; |
| 227 | |
| 228 | // mask off bits below bound |
| 229 | thisword &= kAllSetMask << ShiftOfBit(prev); |
| 230 | |
| 231 | if (thisword != static_cast<WordType>(0)) |
| 232 | { |
| 233 | *result = (i * kBitsPerWord |
| 234 | + __builtin_ctzl(thisword)); |
| 235 | return true; |
| 236 | } |
| 237 | |
| 238 | // check subsequent words |
| 239 | i++; |
| 240 | for (; i < word_size; i++) |
| 241 | { |
| 242 | thisword = words[i]; |
| 243 | if (thisword != static_cast<WordType>(0)) |
| 244 | { |
| 245 | *result = (i * kBitsPerWord |
| 246 | + __builtin_ctzl(thisword)); |
| 247 | return true; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | return false; |
| 252 | } |
| 253 | |
| 254 | void BitmapBase::DoAppendToString(const WordType* words, uint64_t num_bits, std::string* out) |
| 255 | { |
nothing calls this directly
no outgoing calls
no test coverage detected