Chromium Code Reviews| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 16717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16728 } | 16728 } |
| 16729 | 16729 |
| 16730 | 16730 |
| 16731 uint32_t Bigint::AsTruncatedUint32Value() const { | 16731 uint32_t Bigint::AsTruncatedUint32Value() const { |
| 16732 // Note: the previous implementation of Bigint returned the absolute value | 16732 // Note: the previous implementation of Bigint returned the absolute value |
| 16733 // truncated to 32 bits, which is not consistent with Smi and Mint behavior. | 16733 // truncated to 32 bits, which is not consistent with Smi and Mint behavior. |
| 16734 ASSERT(Bigint::kBitsPerDigit == 32); | 16734 ASSERT(Bigint::kBitsPerDigit == 32); |
| 16735 const intptr_t used = Used(); | 16735 const intptr_t used = Used(); |
| 16736 if (used == 0) return 0; | 16736 if (used == 0) return 0; |
| 16737 const uint32_t digit0 = DigitAt(0); | 16737 const uint32_t digit0 = DigitAt(0); |
| 16738 return Neg() ? static_cast<uint32_t>(-digit0) : digit0; | 16738 return Neg() ? static_cast<uint32_t>(-static_cast<int32_t>(digit0)) : digit0; |
|
siva
2014/10/01 00:04:40
The multiple casts does look weird.
| |
| 16739 } | 16739 } |
| 16740 | 16740 |
| 16741 | 16741 |
| 16742 // For positive values: Smi < Mint < Bigint. | 16742 // For positive values: Smi < Mint < Bigint. |
| 16743 int Bigint::CompareWith(const Integer& other) const { | 16743 int Bigint::CompareWith(const Integer& other) const { |
| 16744 ASSERT(!FitsIntoSmi()); | 16744 ASSERT(!FitsIntoSmi()); |
| 16745 ASSERT(!FitsIntoInt64()); | 16745 ASSERT(!FitsIntoInt64()); |
| 16746 if (other.IsBigint() && (IsNegative() == other.IsNegative())) { | 16746 if (other.IsBigint() && (IsNegative() == other.IsNegative())) { |
| 16747 const Bigint& other_bgi = Bigint::Cast(other); | 16747 const Bigint& other_bgi = Bigint::Cast(other); |
| 16748 int64_t result = Used() - other_bgi.Used(); | 16748 int64_t result = Used() - other_bgi.Used(); |
| (...skipping 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20295 return tag_label.ToCString(); | 20295 return tag_label.ToCString(); |
| 20296 } | 20296 } |
| 20297 | 20297 |
| 20298 | 20298 |
| 20299 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20299 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20300 Instance::PrintJSONImpl(stream, ref); | 20300 Instance::PrintJSONImpl(stream, ref); |
| 20301 } | 20301 } |
| 20302 | 20302 |
| 20303 | 20303 |
| 20304 } // namespace dart | 20304 } // namespace dart |
| OLD | NEW |