Chromium Code Reviews| Index: vm/bit_vector.h |
| =================================================================== |
| --- vm/bit_vector.h (revision 8546) |
| +++ vm/bit_vector.h (working copy) |
| @@ -63,6 +63,12 @@ |
| data_[i / kBitsPerWord] |= (static_cast<uword>(1) << (i % kBitsPerWord)); |
| } |
| + bool Contains(int i) const { |
| + ASSERT(i >= 0 && i < length()); |
| + uword block = data_[i / sizeof(uword)]; |
| + return (block & (1U << (i % sizeof(uword)))) != 0; |
|
srdjan
2012/06/12 17:34:37
Please add a test
Florian Schneider
2012/06/13 10:53:40
Done. Good point. I fixed a bug here as well.
|
| + } |
| + |
| void Clear() { |
| for (intptr_t i = 0; i < data_length_; i++) { |
| data_[i] = 0; |