MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / FirstUnset

Method FirstUnset

tensorflow/core/lib/core/bitmap.cc:74–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74size_t Bitmap::FirstUnset(size_t start) const {
75 if (start >= nbits_) {
76 return nbits_;
77 }
78
79 // Mask to or-into first word to account for bits to skip in that word.
80 size_t mask = (1ull << (start % kBits)) - 1;
81 const size_t nwords = NumWords(nbits_);
82 for (size_t i = start / kBits; i < nwords; i++) {
83 Word word = word_[i] | mask;
84 mask = 0; // Only ignore bits in the first word we process.
85 size_t r = FindFirstSet(~word);
86
87 if (r) {
88 size_t result = i * kBits + (r - 1);
89 if (result > nbits_) result = nbits_;
90 return result;
91 }
92 }
93
94 return nbits_;
95}
96
97string Bitmap::ToString() const {
98 string result;

Callers 1

TESTFunction · 0.80

Calls 1

FindFirstSetFunction · 0.85

Tested by 1

TESTFunction · 0.64