| 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 16728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16739 const uint64_t digit1 = DigitAt(1); | 16739 const uint64_t digit1 = DigitAt(1); |
| 16740 const uint64_t value = (digit1 << 32) + DigitAt(0); | 16740 const uint64_t value = (digit1 << 32) + DigitAt(0); |
| 16741 uint64_t limit = Mint::kMaxValue; | 16741 uint64_t limit = Mint::kMaxValue; |
| 16742 if (Neg()) { | 16742 if (Neg()) { |
| 16743 limit++; | 16743 limit++; |
| 16744 } | 16744 } |
| 16745 return value <= limit; | 16745 return value <= limit; |
| 16746 } | 16746 } |
| 16747 | 16747 |
| 16748 | 16748 |
| 16749 int64_t Bigint::AsInt64Value() const { | 16749 int64_t Bigint::AsTruncatedInt64Value() const { |
| 16750 ASSERT(FitsIntoInt64()); | |
| 16751 const intptr_t used = Used(); | 16750 const intptr_t used = Used(); |
| 16752 if (used == 0) return 0; | 16751 if (used == 0) return 0; |
| 16753 const int64_t digit1 = (used > 1) ? DigitAt(1) : 0; | 16752 const int64_t digit1 = (used > 1) ? DigitAt(1) : 0; |
| 16754 const int64_t value = (digit1 << 32) + DigitAt(0); | 16753 const int64_t value = (digit1 << 32) + DigitAt(0); |
| 16755 return Neg() ? -value : value; | 16754 return Neg() ? -value : value; |
| 16756 } | 16755 } |
| 16757 | 16756 |
| 16758 | 16757 |
| 16758 int64_t Bigint::AsInt64Value() const { |
| 16759 ASSERT(FitsIntoInt64()); |
| 16760 return AsTruncatedInt64Value(); |
| 16761 } |
| 16762 |
| 16763 |
| 16759 bool Bigint::FitsIntoUint64() const { | 16764 bool Bigint::FitsIntoUint64() const { |
| 16760 ASSERT(Bigint::kBitsPerDigit == 32); | 16765 ASSERT(Bigint::kBitsPerDigit == 32); |
| 16761 return !Neg() && (Used() <= 2); | 16766 return !Neg() && (Used() <= 2); |
| 16762 } | 16767 } |
| 16763 | 16768 |
| 16764 | 16769 |
| 16765 uint64_t Bigint::AsUint64Value() const { | 16770 uint64_t Bigint::AsUint64Value() const { |
| 16766 ASSERT(FitsIntoUint64()); | 16771 ASSERT(FitsIntoUint64()); |
| 16767 const intptr_t used = Used(); | 16772 const intptr_t used = Used(); |
| 16768 if (used == 0) return 0; | 16773 if (used == 0) return 0; |
| (...skipping 3593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20362 return tag_label.ToCString(); | 20367 return tag_label.ToCString(); |
| 20363 } | 20368 } |
| 20364 | 20369 |
| 20365 | 20370 |
| 20366 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20371 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20367 Instance::PrintJSONImpl(stream, ref); | 20372 Instance::PrintJSONImpl(stream, ref); |
| 20368 } | 20373 } |
| 20369 | 20374 |
| 20370 | 20375 |
| 20371 } // namespace dart | 20376 } // namespace dart |
| OLD | NEW |