MCPcopy Create free account
hub / github.com/apache/arrow / SkipNextZeros

Function SkipNextZeros

cpp/src/arrow/util/bit_run_reader.h:324–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322 }
323
324 void SkipNextZeros() {
325 assert(current_num_bits_ == 0);
326 while (ARROW_PREDICT_TRUE(remaining_ >= 64)) {
327 current_word_ = LoadFullWord();
328 const auto num_zeros = CountFirstZeros(current_word_);
329 if (num_zeros < 64) {
330 // Run of zeros ends here
331 current_word_ = ConsumeBits(current_word_, num_zeros);
332 current_num_bits_ = 64 - num_zeros;
333 remaining_ -= num_zeros;
334 assert(remaining_ >= 0);
335 assert(current_num_bits_ >= 0);
336 return;
337 }
338 remaining_ -= 64;
339 }
340 // Run of zeros continues in last bitmap word
341 if (remaining_ > 0) {
342 current_word_ = LoadPartialWord(/*bit_offset=*/0, remaining_);
343 current_num_bits_ = static_cast<int32_t>(remaining_);
344 const auto num_zeros =
345 std::min<int32_t>(current_num_bits_, CountFirstZeros(current_word_));
346 current_word_ = ConsumeBits(current_word_, num_zeros);
347 current_num_bits_ -= num_zeros;
348 remaining_ -= num_zeros;
349 assert(remaining_ >= 0);
350 assert(current_num_bits_ >= 0);
351 }
352 }
353
354 int64_t CountNextOnes() {
355 assert(current_word_ & kFirstBit);

Callers 1

NextRunFunction · 0.85

Calls 2

LoadFullWordFunction · 0.85
LoadPartialWordFunction · 0.85

Tested by

no test coverage detected