| 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/bitmap.h" |    5 #include "vm/bitmap.h" | 
|    6  |    6  | 
|    7 #include "platform/assert.h" |    7 #include "platform/assert.h" | 
|    8 #include "vm/object.h" |    8 #include "vm/object.h" | 
|    9  |    9  | 
|   10 namespace dart { |   10 namespace dart { | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   65 } |   65 } | 
|   66  |   66  | 
|   67  |   67  | 
|   68 void BitmapBuilder::SetRange(intptr_t min, intptr_t max, bool value) { |   68 void BitmapBuilder::SetRange(intptr_t min, intptr_t max, bool value) { | 
|   69   for (intptr_t i = min; i <= max; i++) { |   69   for (intptr_t i = min; i <= max; i++) { | 
|   70     Set(i, value); |   70     Set(i, value); | 
|   71   } |   71   } | 
|   72 } |   72 } | 
|   73  |   73  | 
|   74  |   74  | 
 |   75 void BitmapBuilder::Print() const { | 
 |   76   for (intptr_t i = 0; i < Length(); i++) { | 
 |   77     if (Get(i)) { | 
 |   78       OS::Print("1"); | 
 |   79     } else { | 
 |   80       OS::Print("0"); | 
 |   81     } | 
 |   82   } | 
 |   83 } | 
 |   84  | 
 |   85  | 
|   75 bool BitmapBuilder::GetBit(intptr_t bit_offset) const { |   86 bool BitmapBuilder::GetBit(intptr_t bit_offset) const { | 
|   76   if (!InRange(bit_offset)) { |   87   if (!InRange(bit_offset)) { | 
|   77     return false; |   88     return false; | 
|   78   } |   89   } | 
|   79   intptr_t byte_offset = bit_offset >> kBitsPerByteLog2; |   90   intptr_t byte_offset = bit_offset >> kBitsPerByteLog2; | 
|   80   ASSERT(byte_offset < data_size_in_bytes_); |   91   ASSERT(byte_offset < data_size_in_bytes_); | 
|   81   intptr_t bit_remainder = bit_offset & (kBitsPerByte - 1); |   92   intptr_t bit_remainder = bit_offset & (kBitsPerByte - 1); | 
|   82   uint8_t mask = 1U << bit_remainder; |   93   uint8_t mask = 1U << bit_remainder; | 
|   83   ASSERT(data_ != NULL); |   94   ASSERT(data_ != NULL); | 
|   84   return ((data_[byte_offset] & mask) != 0); |   95   return ((data_[byte_offset] & mask) != 0); | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|   96   uint8_t mask = 1U << bit_remainder; |  107   uint8_t mask = 1U << bit_remainder; | 
|   97   ASSERT(data_ != NULL); |  108   ASSERT(data_ != NULL); | 
|   98   if (value) { |  109   if (value) { | 
|   99     data_[byte_offset] |= mask; |  110     data_[byte_offset] |= mask; | 
|  100   } else { |  111   } else { | 
|  101     data_[byte_offset] &= ~mask; |  112     data_[byte_offset] &= ~mask; | 
|  102   } |  113   } | 
|  103 } |  114 } | 
|  104  |  115  | 
|  105 }  // namespace dart |  116 }  // namespace dart | 
| OLD | NEW |