MCPcopy Create free account
hub / github.com/bytedance/bolt / findFirstBit

Function findFirstBit

bolt/common/base/BitUtil.h:396–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396inline int32_t findFirstBit(const uint64_t* bits, int32_t begin, int32_t end) {
397 int32_t found = -1;
398 testWords(
399 begin,
400 end,
401 [bits, &found](int32_t idx, uint64_t mask) {
402 uint64_t word = bits[idx] & mask;
403 if (word) {
404 found = idx * 64 + __builtin_ctzll(word);
405 return false;
406 }
407 return true;
408 },
409 [bits, &found](int32_t idx) {
410 uint64_t word = bits[idx];
411 if (word) {
412 found = idx * 64 + __builtin_ctzll(word);
413 return false;
414 }
415 return true;
416 });
417 return found;
418}
419
420/**
421 * Invokes a function for each set or unset bit.

Callers 7

updateBoundsMethod · 0.85
extractNullsMethod · 0.85
refineBooleanMixNonNullFunction · 0.85
allocateFromFreeListsMethod · 0.85
storeStringFastMethod · 0.85
TEST_FFunction · 0.85

Calls 1

testWordsFunction · 0.85

Tested by 1

TEST_FFunction · 0.68