5 #include "src/bit-vector.h" 7 #include "src/base/bits.h" 14 void BitVector::Print() {
17 for (
int i = 0;
i < length();
i++) {
19 if (!first) PrintF(
",");
29 void BitVector::Iterator::Advance() {
35 DCHECK(!target_->is_inline());
36 val = target_->data_.ptr_[current_index_];
37 current_ = current_index_ << kDataBitShift;
39 val = SkipZeroBytes(val);
40 val = SkipZeroBits(val);
41 current_value_ = val >> 1;
45 int BitVector::Count()
const {
46 if (data_length_ == 0) {
47 return base::bits::CountPopulation(data_.inline_);
50 for (
int i = 0;
i < data_length_;
i++) {
51 count += base::bits::CountPopulation(data_.ptr_[
i]);