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

Function FindCurrentRun

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

Source from the content-addressed store, hash-verified

402 }
403
404 SetBitRun FindCurrentRun() {
405 // Skip any pending zeros
406 const auto num_zeros = CountFirstZeros(current_word_);
407 if (num_zeros >= current_num_bits_) {
408 remaining_ -= current_num_bits_;
409 current_word_ = 0;
410 current_num_bits_ = 0;
411 return {0, 0};
412 }
413 assert(num_zeros <= remaining_);
414 current_word_ = ConsumeBits(current_word_, num_zeros);
415 current_num_bits_ -= num_zeros;
416 remaining_ -= num_zeros;
417 const int64_t pos = position();
418 // Count any ones
419 const auto num_ones = CountFirstZeros(~current_word_);
420 assert(num_ones <= current_num_bits_);
421 assert(num_ones <= remaining_);
422 current_word_ = ConsumeBits(current_word_, num_ones);
423 current_num_bits_ -= num_ones;
424 remaining_ -= num_ones;
425 return {pos, num_ones};
426 }
427
428 inline int CountFirstZeros(uint64_t word);
429 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