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