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 abstract class _IntegerImplementation { | 5 abstract class _IntegerImplementation { |
6 // The Dart class _Bigint extending _IntegerImplementation requires a | 6 // The Dart class _Bigint extending _IntegerImplementation requires a |
7 // default constructor. | 7 // default constructor. |
8 | 8 |
| 9 Type get runtimeType => int; |
| 10 |
9 num operator +(num other) { | 11 num operator +(num other) { |
10 var result = other._addFromInteger(this); | 12 var result = other._addFromInteger(this); |
11 if (result != null) return result; | 13 if (result != null) return result; |
12 return other._toBigint()._addFromInteger(this); | 14 return other._toBigint()._addFromInteger(this); |
13 } | 15 } |
14 num operator -(num other) { | 16 num operator -(num other) { |
15 var result = other._subFromInteger(this); | 17 var result = other._subFromInteger(this); |
16 if (result != null) return result; | 18 if (result != null) return result; |
17 return other._toBigint()._subFromInteger(this); | 19 return other._toBigint()._subFromInteger(this); |
18 } | 20 } |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 // Shift by mint exceeds range that can be handled by the VM. | 618 // Shift by mint exceeds range that can be handled by the VM. |
617 int _shrFromInt(int other) { | 619 int _shrFromInt(int other) { |
618 if (other < 0) { | 620 if (other < 0) { |
619 return -1; | 621 return -1; |
620 } else { | 622 } else { |
621 return 0; | 623 return 0; |
622 } | 624 } |
623 } | 625 } |
624 int _shlFromInt(int other) native "Mint_shlFromInt"; | 626 int _shlFromInt(int other) native "Mint_shlFromInt"; |
625 } | 627 } |
OLD | NEW |