| 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 16514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16525 } | 16525 } |
| 16526 intptr_t str_pos = 0; | 16526 intptr_t str_pos = 0; |
| 16527 | 16527 |
| 16528 Bigint& result = Bigint::Handle(Bigint::New(space)); | 16528 Bigint& result = Bigint::Handle(Bigint::New(space)); |
| 16529 // One decimal digit takes log2(10) bits, i.e. ~3.32192809489 bits. | 16529 // One decimal digit takes log2(10) bits, i.e. ~3.32192809489 bits. |
| 16530 // That is a theoretical limit for large numbers. | 16530 // That is a theoretical limit for large numbers. |
| 16531 // The extra digits allocated take care of variations (kExtraDigits). | 16531 // The extra digits allocated take care of variations (kExtraDigits). |
| 16532 const int64_t kLog10Dividend = 33219281; | 16532 const int64_t kLog10Dividend = 33219281; |
| 16533 const int64_t kLog10Divisor = 10000000; | 16533 const int64_t kLog10Divisor = 10000000; |
| 16534 result.EnsureLength((kLog10Dividend * str_length) / | 16534 result.EnsureLength((kLog10Dividend * str_length) / |
| 16535 (kLog10Divisor * kBitsPerDigit), space); | 16535 (kLog10Divisor * kBitsPerDigit) + 1, space); |
| 16536 | 16536 |
| 16537 // Read first digit separately. This avoids a multiplication and addition. | 16537 // Read first digit separately. This avoids a multiplication and addition. |
| 16538 // The first digit might also not have kDecDigitsPerIteration decimal digits. | 16538 // The first digit might also not have kDecDigitsPerIteration decimal digits. |
| 16539 const intptr_t lsdigit_length = str_length % kDecDigitsPerIteration; | 16539 const intptr_t lsdigit_length = str_length % kDecDigitsPerIteration; |
| 16540 uint32_t digit = 0; | 16540 uint32_t digit = 0; |
| 16541 for (intptr_t i = 0; i < lsdigit_length; i++) { | 16541 for (intptr_t i = 0; i < lsdigit_length; i++) { |
| 16542 char c = str[str_pos++]; | 16542 char c = str[str_pos++]; |
| 16543 ASSERT(('0' <= c) && (c <= '9')); | 16543 ASSERT(('0' <= c) && (c <= '9')); |
| 16544 digit = digit * 10 + c - '0'; | 16544 digit = digit * 10 + c - '0'; |
| 16545 } | 16545 } |
| (...skipping 3806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20352 return tag_label.ToCString(); | 20352 return tag_label.ToCString(); |
| 20353 } | 20353 } |
| 20354 | 20354 |
| 20355 | 20355 |
| 20356 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20356 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20357 Instance::PrintJSONImpl(stream, ref); | 20357 Instance::PrintJSONImpl(stream, ref); |
| 20358 } | 20358 } |
| 20359 | 20359 |
| 20360 | 20360 |
| 20361 } // namespace dart | 20361 } // namespace dart |
| OLD | NEW |