| 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 /** | 5 /** |
| 6 * An immutable 64-bit signed integer, in the range [-2^63, 2^63 - 1]. | 6 * An immutable 64-bit signed integer, in the range [-2^63, 2^63 - 1]. |
| 7 * Arithmetic operations may overflow in order to maintain this range. | 7 * Arithmetic operations may overflow in order to maintain this range. |
| 8 */ | 8 */ |
| 9 class int64 implements intx { | 9 class int64 implements intx { |
| 10 | 10 |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 bool isEven() => (_l & 0x1) == 0; | 564 bool isEven() => (_l & 0x1) == 0; |
| 565 bool isMaxValue() => (_h == _MASK_2 >> 1) && _m == _MASK && _l == _MASK; | 565 bool isMaxValue() => (_h == _MASK_2 >> 1) && _m == _MASK && _l == _MASK; |
| 566 bool isMinValue() => _h == _SIGN_BIT_VALUE && _m == 0 && _l == 0; | 566 bool isMinValue() => _h == _SIGN_BIT_VALUE && _m == 0 && _l == 0; |
| 567 bool isNegative() => (_h >> (_BITS2 - 1)) != 0; | 567 bool isNegative() => (_h >> (_BITS2 - 1)) != 0; |
| 568 bool isOdd() => (_l & 0x1) == 1; | 568 bool isOdd() => (_l & 0x1) == 1; |
| 569 bool isZero() => _h == 0 && _m == 0 && _l == 0; | 569 bool isZero() => _h == 0 && _m == 0 && _l == 0; |
| 570 | 570 |
| 571 /** | 571 /** |
| 572 * Returns a hash code based on all the bits of this [int64]. | 572 * Returns a hash code based on all the bits of this [int64]. |
| 573 */ | 573 */ |
| 574 int hashCode() { | 574 int get hashCode { |
| 575 int bottom = ((_m & 0x3ff) << _BITS) | _l; | 575 int bottom = ((_m & 0x3ff) << _BITS) | _l; |
| 576 int top = (_h << 12) | ((_m >> 10) & 0xfff); | 576 int top = (_h << 12) | ((_m >> 10) & 0xfff); |
| 577 return bottom ^ top; | 577 return bottom ^ top; |
| 578 } | 578 } |
| 579 | 579 |
| 580 int64 abs() { | 580 int64 abs() { |
| 581 return this < 0 ? -this : this; | 581 return this < 0 ? -this : this; |
| 582 } | 582 } |
| 583 | 583 |
| 584 /** | 584 /** |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 } | 1086 } |
| 1087 } | 1087 } |
| 1088 return ZERO; | 1088 return ZERO; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 // Generate the quotient using bit-at-a-time long division. | 1091 // Generate the quotient using bit-at-a-time long division. |
| 1092 return _divModHelper(aIsCopy ? a : new int64._copy(a), b, negative, | 1092 return _divModHelper(aIsCopy ? a : new int64._copy(a), b, negative, |
| 1093 aIsNegative, aIsMinValue, computeRemainder); | 1093 aIsNegative, aIsMinValue, computeRemainder); |
| 1094 } | 1094 } |
| 1095 } | 1095 } |
| OLD | NEW |