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 part of fixnum; | 5 part of fixnum; |
6 | 6 |
7 /** | 7 /** |
8 * An immutable 64-bit signed integer, in the range [-2^63, 2^63 - 1]. | 8 * An immutable 64-bit signed integer, in the range [-2^63, 2^63 - 1]. |
9 * Arithmetic operations may overflow in order to maintain this range. | 9 * Arithmetic operations may overflow in order to maintain this range. |
10 */ | 10 */ |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } else { | 433 } else { |
434 res2 = 0; | 434 res2 = 0; |
435 res1 = 0; | 435 res1 = 0; |
436 res0 = a2 >> (n - _BITS01); | 436 res0 = a2 >> (n - _BITS01); |
437 } | 437 } |
438 | 438 |
439 return Int64._masked(res0, res1, res2); | 439 return Int64._masked(res0, res1, res2); |
440 } | 440 } |
441 | 441 |
442 /** | 442 /** |
443 * Returns [true] if this [Int64] has the same numeric value as the | 443 * Returns [:true:] if this [Int64] has the same numeric value as the |
444 * given object. The argument may be an [int] or an [IntX]. | 444 * given object. The argument may be an [int] or an [IntX]. |
445 */ | 445 */ |
446 bool operator ==(other) { | 446 bool operator ==(other) { |
447 Int64 o; | 447 Int64 o; |
448 if (other is Int64) { | 448 if (other is Int64) { |
449 o = other; | 449 o = other; |
450 } else if (other is int) { | 450 } else if (other is int) { |
451 if (_h == 0 && _m == 0) return _l == other; | 451 if (_h == 0 && _m == 0) return _l == other; |
452 // Since we know one of [_h] or [_m] is non-zero, if [other] fits in the | 452 // Since we know one of [_h] or [_m] is non-zero, if [other] fits in the |
453 // low word then it can't be numerically equal. | 453 // low word then it can't be numerically equal. |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 if (r0 == 0 && r1 == 0 && r2 == 0) { | 1033 if (r0 == 0 && r1 == 0 && r2 == 0) { |
1034 return ZERO; | 1034 return ZERO; |
1035 } else { | 1035 } else { |
1036 return _sub(b0, b1, b2, r0, r1, r2); | 1036 return _sub(b0, b1, b2, r0, r1, r2); |
1037 } | 1037 } |
1038 } else { | 1038 } else { |
1039 return _negate(r0, r1, r2); | 1039 return _negate(r0, r1, r2); |
1040 } | 1040 } |
1041 } | 1041 } |
1042 } | 1042 } |
OLD | NEW |