Chromium Code Reviews| Index: runtime/vm/bit_vector.cc |
| =================================================================== |
| --- runtime/vm/bit_vector.cc (revision 12420) |
| +++ runtime/vm/bit_vector.cc (working copy) |
| @@ -33,6 +33,14 @@ |
| } |
| +bool BitVector::Equals(const BitVector& other) const { |
| + for (int i = 0; i < data_length_; i++) { |
| + if (data_[i] != other.data_[i]) return false; |
| + } |
| + return true; |
| +} |
| + |
| + |
| bool BitVector::AddAll(BitVector* from) { |
| ASSERT(data_length_ == from->data_length_); |
| bool changed = false; |
| @@ -60,4 +68,25 @@ |
| } |
| +bool BitVector::Intersect(const BitVector& other) { |
|
Kevin Millikin (Google)
2012/09/17 12:09:47
It doesn't look like you use the return value, so
Florian Schneider
2012/09/17 14:20:59
Done.
|
| + ASSERT(other.length() == length()); |
| + bool changed = false; |
| + for (int i = 0; i < data_length_; i++) { |
| + const uword before = data_[i]; |
| + const uword after = data_[i] & other.data_[i]; |
| + if (before != after) changed = true; |
| + data_[i] = after; |
| + } |
| + return changed; |
| +} |
| + |
| + |
| +void BitVector::Print() const { |
| + OS::Print("["); |
| + for (intptr_t i = 0; i < length_; i++) { |
| + OS::Print(Contains(i) ? "1" : "0"); |
| + } |
| + OS::Print("]"); |
| +} |
| + |
| } // namespace dart |