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

Function FindCurrentRun

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

Source from the content-addressed store, hash-verified

408 }
409
410 SetBitRun FindCurrentRun() {
411 // Skip any pending zeros
412 const auto num_zeros = CountFirstZeros(current_word_);
413 if (num_zeros >= current_num_bits_) {
414 remaining_ -= current_num_bits_;
415 current_word_ = 0;
416 current_num_bits_ = 0;
417 return {0, 0};
418 }
419 assert(num_zeros <= remaining_);
420 current_word_ = ConsumeBits(current_word_, num_zeros);
421 current_num_bits_ -= num_zeros;
422 remaining_ -= num_zeros;
423 const int64_t pos = position();
424 // Count any ones
425 const auto num_ones = CountFirstZeros(~current_word_);
426 assert(num_ones <= current_num_bits_);
427 assert(num_ones <= remaining_);
428 current_word_ = ConsumeBits(current_word_, num_ones);
429 current_num_bits_ -= num_ones;
430 remaining_ -= num_ones;
431 return {pos, num_ones};
432 }
433
434 inline int CountFirstZeros(uint64_t word);
435 inline uint64_t ConsumeBits(uint64_t word, int32_t num_bits);

Callers 1

NextRunFunction · 0.85

Calls 1

positionFunction · 0.50

Tested by

no test coverage detected