OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/bit_vector.h" | 5 #include "vm/bit_vector.h" |
6 | 6 |
7 #include "vm/os.h" | 7 #include "vm/os.h" |
8 | 8 |
9 namespace dart { | 9 namespace dart { |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 | 94 |
95 void BitVector::Intersect(const BitVector* other) { | 95 void BitVector::Intersect(const BitVector* other) { |
96 ASSERT(other->length() == length()); | 96 ASSERT(other->length() == length()); |
97 for (intptr_t i = 0; i < data_length_; i++) { | 97 for (intptr_t i = 0; i < data_length_; i++) { |
98 data_[i] = data_[i] & other->data_[i]; | 98 data_[i] = data_[i] & other->data_[i]; |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 | 102 |
| 103 bool BitVector::IsEmpty() const { |
| 104 for (intptr_t i = 0; i < data_length_; i++) { |
| 105 if (data_[i] != 0) { |
| 106 return false; |
| 107 } |
| 108 } |
| 109 return true; |
| 110 } |
| 111 |
| 112 |
103 void BitVector::Print() const { | 113 void BitVector::Print() const { |
104 OS::Print("["); | 114 OS::Print("["); |
105 for (intptr_t i = 0; i < length_; i++) { | 115 for (intptr_t i = 0; i < length_; i++) { |
106 OS::Print(Contains(i) ? "1" : "0"); | 116 OS::Print(Contains(i) ? "1" : "0"); |
107 } | 117 } |
108 OS::Print("]"); | 118 OS::Print("]"); |
109 } | 119 } |
110 | 120 |
111 } // namespace dart | 121 } // namespace dart |
OLD | NEW |