#include <bit_vector.h>
Definition at line 15 of file bit_vector.h.
◆ BitVector()
dart::BitVector::BitVector |
( |
Zone * |
zone, |
|
|
intptr_t |
length |
|
) |
| |
|
inline |
Definition at line 47 of file bit_vector.h.
50 data_(zone->Alloc<
uword>(data_length_)) {
52 }
static intptr_t SizeFor(intptr_t length)
◆ Add()
void dart::BitVector::Add |
( |
intptr_t |
i | ) |
|
|
inline |
Definition at line 63 of file bit_vector.h.
63 {
66 }
constexpr intptr_t kBitsPerWord
◆ AddAll()
bool dart::BitVector::AddAll |
( |
const BitVector * |
from | ) |
|
Definition at line 52 of file bit_vector.cc.
52 {
53 ASSERT(data_length_ == from->data_length_);
54 bool changed = false;
55 for (intptr_t i = 0; i < data_length_; i++) {
56 const uword before = data_[i];
57 const uword after = data_[i] | from->data_[i];
58 if (before != after) {
59 changed = true;
60 data_[i] = after;
61 }
62 }
63 return changed;
64}
◆ Clear()
void dart::BitVector::Clear |
( |
| ) |
|
|
inline |
Definition at line 105 of file bit_vector.h.
105 {
106 for (intptr_t i = 0; i < data_length_; i++) {
107 data_[i] = 0;
108 }
109 }
◆ Contains()
bool dart::BitVector::Contains |
( |
intptr_t |
i | ) |
const |
|
inline |
◆ CopyFrom()
void dart::BitVector::CopyFrom |
( |
const BitVector * |
other | ) |
|
|
inline |
Definition at line 54 of file bit_vector.h.
54 {
57 }
bool AddAll(const BitVector *from)
◆ Equals()
bool dart::BitVector::Equals |
( |
const BitVector & |
other | ) |
const |
Definition at line 35 of file bit_vector.cc.
35 {
36 if (length_ != other.length_) return false;
37 intptr_t i = 0;
38 for (; i < data_length_ - 1; i++) {
39 if (data_[i] != other.data_[i]) return false;
40 }
41 if (i < data_length_) {
42 if (length_ %
kBitsPerWord == 0)
return data_[i] == other.data_[i];
43
44
46 const uword mask =
static_cast<uword>(-1) >> shift_size;
47 if ((data_[i] & mask) != (other.data_[i] & mask)) return false;
48 }
49 return true;
50}
◆ Intersect()
void dart::BitVector::Intersect |
( |
const BitVector * |
other | ) |
|
Definition at line 93 of file bit_vector.cc.
93 {
95 for (intptr_t i = 0; i < data_length_; i++) {
96 data_[i] = data_[i] & other->data_[i];
97 }
98}
◆ IsEmpty()
bool dart::BitVector::IsEmpty |
( |
| ) |
const |
Definition at line 100 of file bit_vector.cc.
100 {
101 for (intptr_t i = 0; i < data_length_; i++) {
102 if (data_[i] != 0) {
103 return false;
104 }
105 }
106 return true;
107}
◆ KillAndAdd()
Definition at line 80 of file bit_vector.cc.
80 {
81 ASSERT(data_length_ == kill->data_length_);
82 ASSERT(data_length_ ==
gen->data_length_);
83 bool changed = false;
84 for (intptr_t i = 0; i < data_length_; i++) {
85 const uword before = data_[i];
86 const uword after = data_[i] | (
gen->data_[i] & ~kill->data_[i]);
87 if (before != after) changed = true;
88 data_[i] = after;
89 }
90 return changed;
91}
◆ length()
intptr_t dart::BitVector::length |
( |
| ) |
const |
|
inline |
◆ Print()
void dart::BitVector::Print |
( |
| ) |
const |
Definition at line 109 of file bit_vector.cc.
109 {
111 for (intptr_t i = 0; i < length_; i++) {
113 }
115}
bool Contains(intptr_t i) const
#define THR_Print(format,...)
◆ Remove()
void dart::BitVector::Remove |
( |
intptr_t |
i | ) |
|
|
inline |
◆ RemoveAll()
bool dart::BitVector::RemoveAll |
( |
const BitVector * |
from | ) |
|
Definition at line 66 of file bit_vector.cc.
66 {
67 ASSERT(data_length_ == from->data_length_);
68 bool changed = false;
69 for (intptr_t i = 0; i < data_length_; i++) {
70 const uword before = data_[i];
71 const uword after = data_[i] & ~from->data_[i];
72 if (before != after) {
73 changed = true;
74 data_[i] = after;
75 }
76 }
77 return changed;
78}
◆ Set()
void dart::BitVector::Set |
( |
intptr_t |
i, |
|
|
bool |
value |
|
) |
| |
|
inline |
◆ SetAll()
void dart::BitVector::SetAll |
( |
| ) |
|
|
inline |
Definition at line 111 of file bit_vector.h.
111 {
112 for (intptr_t i = 0; i < data_length_; i++) {
113 data_[i] =
static_cast<uword>(-1);
114 }
115 }
◆ SizeFor()
static intptr_t dart::BitVector::SizeFor |
( |
intptr_t |
length | ) |
|
|
inlinestatic |
◆ SubsetOf()
bool dart::BitVector::SubsetOf |
( |
const BitVector & |
other | ) |
|
|
inline |
Definition at line 97 of file bit_vector.h.
97 {
98 ASSERT(length_ == other.length_);
99 for (intptr_t i = 0; i < data_length_; ++i) {
100 if ((data_[i] & other.data_[i]) != data_[i]) return false;
101 }
102 return true;
103 }
The documentation for this class was generated from the following files: