1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "src/bit-vector.h"
7 #include "src/base/bits.h"
8 #include "src/scopes.h"
14 void BitVector::Print() {
17 for (int i = 0; i < length(); i++) {
19 if (!first) PrintF(",");
29 void BitVector::Iterator::Advance() {
31 uintptr_t val = current_value_;
35 val = target_->data_[current_index_];
36 current_ = current_index_ << kDataBitShift;
38 val = SkipZeroBytes(val);
39 val = SkipZeroBits(val);
40 current_value_ = val >> 1;
44 int BitVector::Count() const {
46 for (int i = 0; i < data_length_; i++) {
47 uintptr_t data = data_[i];
48 if (sizeof(data) == 8) {
49 count += base::bits::CountPopulation64(data);
51 count += base::bits::CountPopulation32(static_cast<uint32_t>(data));
57 } // namespace internal