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

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

Issue 10919024: - Change "static final" to "static const" in the (Closed) Base URL: http://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/test/int_64_vm_test.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
11 // A 64-bit integer is represented internally as three non-negative 11 // A 64-bit integer is represented internally as three non-negative
12 // integers, storing the 22 low, 22 middle, and 20 high bits of the 12 // integers, storing the 22 low, 22 middle, and 20 high bits of the
13 // 64-bit value. _l (low) and _m (middle) are in the range 13 // 64-bit value. _l (low) and _m (middle) are in the range
14 // [0, 2^22 - 1] and _h (high) is in the range [0, 2^20 - 1]. 14 // [0, 2^22 - 1] and _h (high) is in the range [0, 2^20 - 1].
15 int _l, _m, _h; 15 int _l, _m, _h;
16 16
17 // Note: instances of int64 are immutable outside of this library, 17 // Note: instances of int64 are immutable outside of this library,
18 // therefore we may return a reference to an existing instance. 18 // therefore we may return a reference to an existing instance.
19 // We take care to perform mutation only on internally-generated 19 // We take care to perform mutation only on internally-generated
20 // instances before they are exposed to external code. 20 // instances before they are exposed to external code.
21 21
22 // Note: several functions require _BITS == 22 -- do not change this value. 22 // Note: several functions require _BITS == 22 -- do not change this value.
23 static final int _BITS = 22; 23 static const int _BITS = 22;
24 static final int _BITS01 = 44; // 2 * _BITS 24 static const int _BITS01 = 44; // 2 * _BITS
25 static final int _BITS2 = 20; // 64 - _BITS01 25 static const int _BITS2 = 20; // 64 - _BITS01
26 static final int _MASK = 4194303; // (1 << _BITS) - 1 26 static const int _MASK = 4194303; // (1 << _BITS) - 1
27 static final int _MASK_2 = 1048575; // (1 << _BITS2) - 1 27 static const int _MASK_2 = 1048575; // (1 << _BITS2) - 1
28 static final int _SIGN_BIT = 19; // _BITS2 - 1 28 static const int _SIGN_BIT = 19; // _BITS2 - 1
29 static final int _SIGN_BIT_VALUE = 524288; // 1 << _SIGN_BIT 29 static const int _SIGN_BIT_VALUE = 524288; // 1 << _SIGN_BIT
30 30
31 // Cached constants 31 // Cached constants
32 static int64 _MAX_VALUE; 32 static int64 _MAX_VALUE;
33 static int64 _MIN_VALUE; 33 static int64 _MIN_VALUE;
34 static int64 _ZERO; 34 static int64 _ZERO;
35 static int64 _ONE; 35 static int64 _ONE;
36 static int64 _TWO; 36 static int64 _TWO;
37 37
38 // Precompute the radix strings for MIN_VALUE to avoid the problem 38 // Precompute the radix strings for MIN_VALUE to avoid the problem
39 // of overflow of -MIN_VALUE. 39 // of overflow of -MIN_VALUE.
(...skipping 1046 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/test/int_64_vm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698