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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 o = new Int64(other); | 451 o = new Int64(other); |
452 } else if (other is Int32) { | 452 } else if (other is Int32) { |
453 o = other.toInt64(); | 453 o = other.toInt64(); |
454 } | 454 } |
455 if (o != null) { | 455 if (o != null) { |
456 return _l == o._l && _m == o._m && _h == o._h; | 456 return _l == o._l && _m == o._m && _h == o._h; |
457 } | 457 } |
458 return false; | 458 return false; |
459 } | 459 } |
460 | 460 |
461 int compareTo(Comparable other) =>_compareTo(other); | 461 int compareTo(other) => _compareTo(other); |
462 | 462 |
463 int _compareTo(other) { | 463 int _compareTo(other) { |
464 Int64 o = _promote(other); | 464 Int64 o = _promote(other); |
465 int signa = _h >> (_BITS2 - 1); | 465 int signa = _h >> (_BITS2 - 1); |
466 int signb = o._h >> (_BITS2 - 1); | 466 int signb = o._h >> (_BITS2 - 1); |
467 if (signa != signb) { | 467 if (signa != signb) { |
468 return signa == 0 ? 1 : -1; | 468 return signa == 0 ? 1 : -1; |
469 } | 469 } |
470 if (_h > o._h) { | 470 if (_h > o._h) { |
471 return 1; | 471 return 1; |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 if (r0 == 0 && r1 == 0 && r2 == 0) { | 990 if (r0 == 0 && r1 == 0 && r2 == 0) { |
991 return ZERO; | 991 return ZERO; |
992 } else { | 992 } else { |
993 return _sub(b0, b1, b2, r0, r1, r2); | 993 return _sub(b0, b1, b2, r0, r1, r2); |
994 } | 994 } |
995 } else { | 995 } else { |
996 return _negate(r0, r1, r2); | 996 return _negate(r0, r1, r2); |
997 } | 997 } |
998 } | 998 } |
999 } | 999 } |
OLD | NEW |