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

Function SkipNextZeros

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

Source from the content-addressed store, hash-verified

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

Callers 1

NextRunFunction · 0.85

Calls 2

LoadFullWordFunction · 0.85
LoadPartialWordFunction · 0.85

Tested by

no test coverage detected