| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 intptr_t bit_remainder = bit_offset & (kBitsPerByte - 1); | 81 intptr_t bit_remainder = bit_offset & (kBitsPerByte - 1); |
| 82 uint8_t mask = 1U << bit_remainder; | 82 uint8_t mask = 1U << bit_remainder; |
| 83 ASSERT(data_ != NULL); | 83 ASSERT(data_ != NULL); |
| 84 return ((data_[byte_offset] & mask) != 0); | 84 return ((data_[byte_offset] & mask) != 0); |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 void BitmapBuilder::SetBit(intptr_t bit_offset, bool value) { | 88 void BitmapBuilder::SetBit(intptr_t bit_offset, bool value) { |
| 89 if (!InRange(bit_offset)) { | 89 if (!InRange(bit_offset)) { |
| 90 FATAL1("Fatal error in BitmapBuilder::SetBit :" | 90 FATAL1("Fatal error in BitmapBuilder::SetBit :" |
| 91 " invalid bit_offset, %"Pd"\n", bit_offset); | 91 " invalid bit_offset, %" Pd "\n", bit_offset); |
| 92 } | 92 } |
| 93 int byte_offset = bit_offset >> kBitsPerByteLog2; | 93 int byte_offset = bit_offset >> kBitsPerByteLog2; |
| 94 ASSERT(byte_offset < data_size_in_bytes_); | 94 ASSERT(byte_offset < data_size_in_bytes_); |
| 95 int bit_remainder = bit_offset & (kBitsPerByte - 1); | 95 int bit_remainder = bit_offset & (kBitsPerByte - 1); |
| 96 uint8_t mask = 1U << bit_remainder; | 96 uint8_t mask = 1U << bit_remainder; |
| 97 ASSERT(data_ != NULL); | 97 ASSERT(data_ != NULL); |
| 98 if (value) { | 98 if (value) { |
| 99 data_[byte_offset] |= mask; | 99 data_[byte_offset] |= mask; |
| 100 } else { | 100 } else { |
| 101 data_[byte_offset] &= ~mask; | 101 data_[byte_offset] &= ~mask; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace dart | 105 } // namespace dart |
| OLD | NEW |