Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: pkg/fixnum/int64.dart

Issue 10911206: Remove support for operator negate and replace occurrences with unary (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/fixnum/int32.dart ('k') | pkg/fixnum/intx.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 int64 o = _promote(other); 266 int64 o = _promote(other);
267 267
268 int sum0 = _l - o._l; 268 int sum0 = _l - o._l;
269 int sum1 = _m - o._m + _shiftRight(sum0, _BITS); 269 int sum1 = _m - o._m + _shiftRight(sum0, _BITS);
270 int sum2 = _h - o._h + _shiftRight(sum1, _BITS); 270 int sum2 = _h - o._h + _shiftRight(sum1, _BITS);
271 271
272 int64 result = new int64._bits(sum0 & _MASK, sum1 & _MASK, sum2 & _MASK_2); 272 int64 result = new int64._bits(sum0 & _MASK, sum1 & _MASK, sum2 & _MASK_2);
273 return result; 273 return result;
274 } 274 }
275 275
276 int64 operator negate() { 276 int64 operator -() {
277 // Like 0 - this. 277 // Like 0 - this.
278 int sum0 = -_l; 278 int sum0 = -_l;
279 int sum1 = -_m + _shiftRight(sum0, _BITS); 279 int sum1 = -_m + _shiftRight(sum0, _BITS);
280 int sum2 = -_h + _shiftRight(sum1, _BITS); 280 int sum2 = -_h + _shiftRight(sum1, _BITS);
281 281
282 return new int64._bits(sum0 & _MASK, sum1 & _MASK, sum2 & _MASK_2); 282 return new int64._bits(sum0 & _MASK, sum1 & _MASK, sum2 & _MASK_2);
283 } 283 }
284 284
285 int64 operator *(other) { 285 int64 operator *(other) {
286 int64 o = _promote(other); 286 int64 o = _promote(other);
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « pkg/fixnum/int32.dart ('k') | pkg/fixnum/intx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698