Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
dart::BitVector::Iterator Class Reference

#include <bit_vector.h>

Inheritance diagram for dart::BitVector::Iterator:
dart::ValueObject

Public Member Functions

 Iterator (BitVector *target)
 
 ~Iterator ()
 
bool Done () const
 
void Advance ()
 
intptr_t Current () const
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Friends

class BitVector
 

Detailed Description

Definition at line 18 of file bit_vector.h.

Constructor & Destructor Documentation

◆ Iterator()

dart::BitVector::Iterator::Iterator ( BitVector target)
inlineexplicit

Definition at line 20 of file bit_vector.h.

21 : target_(target),
22 bit_index_(-1),
23 word_index_(0),
24 current_word_(target->data_[0]) {
25 ASSERT(target->data_length_ > 0);
26 Advance();
27 }
#define ASSERT(E)
uint32_t * target

◆ ~Iterator()

dart::BitVector::Iterator::~Iterator ( )
inline

Definition at line 28 of file bit_vector.h.

28{}

Member Function Documentation

◆ Advance()

void dart::BitVector::Iterator::Advance ( )

Definition at line 11 of file bit_vector.cc.

11 {
12 ++bit_index_;
13 // Skip zero words.
14 if (current_word_ == 0) {
15 do {
16 ++word_index_;
17 if (Done()) return;
18 current_word_ = target_->data_[word_index_];
19 } while (current_word_ == 0);
20 bit_index_ = word_index_ * kBitsPerWord;
21 }
22 // Skip zero bytes.
23 while ((current_word_ & 0xff) == 0) {
24 current_word_ >>= 8;
25 bit_index_ += 8;
26 }
27 // Skip zero bits.
28 while ((current_word_ & 0x1) == 0) {
29 current_word_ >>= 1;
30 ++bit_index_;
31 }
32 current_word_ = current_word_ >> 1;
33}
constexpr intptr_t kBitsPerWord
Definition globals.h:514

◆ Current()

intptr_t dart::BitVector::Iterator::Current ( ) const
inline

Definition at line 33 of file bit_vector.h.

33 {
34 ASSERT(!Done());
35 return bit_index_;
36 }

◆ Done()

bool dart::BitVector::Iterator::Done ( ) const
inline

Definition at line 30 of file bit_vector.h.

30{ return word_index_ >= target_->data_length_; }

Friends And Related Symbol Documentation

◆ BitVector

friend class BitVector
friend

Definition at line 44 of file bit_vector.h.


The documentation for this class was generated from the following files: