MCPcopy Create free account
hub / github.com/chen3feng/toft / DoIsSubsetOf

Method DoIsSubsetOf

container/bitmap.cpp:127–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127bool BitmapBase::DoIsSubsetOf(
128 const WordType* words,
129 const WordType* fullset_words,
130 uint64_t num_bits)
131{
132 const size_t last_word_index = num_bits / kBitsPerWord;
133 const size_t tail_bits = num_bits % kBitsPerWord;
134
135 for (size_t i = 0; i < last_word_index; ++i)
136 {
137 if ((words[i] | fullset_words[i]) != fullset_words[i])
138 return false;
139 }
140
141 if (tail_bits > 0)
142 {
143 WordType mask = (1ULL << tail_bits) - 1;
144 WordType tail_word = words[last_word_index] & mask;
145 WordType fullset_tail_word = fullset_words[last_word_index] & mask;
146 if ((tail_word | fullset_tail_word) != fullset_tail_word)
147 return false;
148 }
149
150 return true;
151}
152
153void BitmapBase::DoLeftShift(WordType* words, uint64_t num_bits, size_t shift)
154{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected