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

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

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 years, 9 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
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 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 618
619 zeros = int32._numberOfTrailingZeros(_h); 619 zeros = int32._numberOfTrailingZeros(_h);
620 if (zeros < 32) { 620 if (zeros < 32) {
621 return _BITS01 + zeros; 621 return _BITS01 + zeros;
622 } 622 }
623 // All zeros 623 // All zeros
624 return 64; 624 return 64;
625 } 625 }
626 626
627 List<int> toBytes() { 627 List<int> toBytes() {
628 List<int> result = new List<int>.fixedLength(8); 628 List<int> result = new List<int>(8);
629 result[0] = _l & 0xff; 629 result[0] = _l & 0xff;
630 result[1] = (_l >> 8) & 0xff; 630 result[1] = (_l >> 8) & 0xff;
631 result[2] = ((_m << 6) & 0xfc) | ((_l >> 16) & 0x3f); 631 result[2] = ((_m << 6) & 0xfc) | ((_l >> 16) & 0x3f);
632 result[3] = (_m >> 2) & 0xff; 632 result[3] = (_m >> 2) & 0xff;
633 result[4] = (_m >> 10) & 0xff; 633 result[4] = (_m >> 10) & 0xff;
634 result[5] = ((_h << 4) & 0xf0) | ((_m >> 18) & 0xf); 634 result[5] = ((_h << 4) & 0xf0) | ((_m >> 18) & 0xf);
635 result[6] = (_h >> 4) & 0xff; 635 result[6] = (_h >> 4) & 0xff;
636 result[7] = (_h >> 12) & 0xff; 636 result[7] = (_h >> 12) & 0xff;
637 return result; 637 return result;
638 } 638 }
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 } 1088 }
1089 } 1089 }
1090 return ZERO; 1090 return ZERO;
1091 } 1091 }
1092 1092
1093 // Generate the quotient using bit-at-a-time long division. 1093 // Generate the quotient using bit-at-a-time long division.
1094 return _divModHelper(aIsCopy ? a : new int64._copy(a), b, negative, 1094 return _divModHelper(aIsCopy ? a : new int64._copy(a), b, negative,
1095 aIsNegative, aIsMinValue, computeRemainder); 1095 aIsNegative, aIsMinValue, computeRemainder);
1096 } 1096 }
1097 } 1097 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698