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

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

Issue 21169002: Int32 constants should be const. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « no previous file | no next file » | 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 part of fixnum; 5 part of fixnum;
6 6
7 /** 7 /**
8 * An immutable 32-bit signed integer, in the range [-2^31, 2^31 - 1]. 8 * An immutable 32-bit signed integer, in the range [-2^31, 2^31 - 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 */
11 class Int32 implements IntX { 11 class Int32 implements IntX {
12 12
13 /** 13 /**
14 * The maximum positive value attainable by an [Int32], namely 14 * The maximum positive value attainable by an [Int32], namely
15 * 2147483647. 15 * 2147483647.
16 */ 16 */
17 static const Int32 MAX_VALUE = const Int32._internal(0x7FFFFFFF); 17 static const Int32 MAX_VALUE = const Int32._internal(0x7FFFFFFF);
18 18
19 /** 19 /**
20 * The minimum positive value attainable by an [Int32], namely 20 * The minimum positive value attainable by an [Int32], namely
21 * -2147483648. 21 * -2147483648.
22 */ 22 */
23 static Int32 MIN_VALUE = const Int32._internal(-0x80000000); 23 static const Int32 MIN_VALUE = const Int32._internal(-0x80000000);
24 24
25 /** 25 /**
26 * An [Int32] constant equal to 0. 26 * An [Int32] constant equal to 0.
27 */ 27 */
28 static Int32 ZERO = const Int32._internal(0); 28 static const Int32 ZERO = const Int32._internal(0);
29 29
30 /** 30 /**
31 * An [Int32] constant equal to 1. 31 * An [Int32] constant equal to 1.
32 */ 32 */
33 static Int32 ONE = const Int32._internal(1); 33 static const Int32 ONE = const Int32._internal(1);
34 34
35 /** 35 /**
36 * An [Int32] constant equal to 2. 36 * An [Int32] constant equal to 2.
37 */ 37 */
38 static Int32 TWO = const Int32._internal(2); 38 static const Int32 TWO = const Int32._internal(2);
39 39
40 // Hex digit char codes 40 // Hex digit char codes
41 static const int _CC_0 = 48; // '0'.codeUnitAt(0) 41 static const int _CC_0 = 48; // '0'.codeUnitAt(0)
42 static const int _CC_9 = 57; // '9'.codeUnitAt(0) 42 static const int _CC_9 = 57; // '9'.codeUnitAt(0)
43 static const int _CC_a = 97; // 'a'.codeUnitAt(0) 43 static const int _CC_a = 97; // 'a'.codeUnitAt(0)
44 static const int _CC_z = 122; // 'z'.codeUnitAt(0) 44 static const int _CC_z = 122; // 'z'.codeUnitAt(0)
45 static const int _CC_A = 65; // 'A'.codeUnitAt(0) 45 static const int _CC_A = 65; // 'A'.codeUnitAt(0)
46 static const int _CC_Z = 90; // 'Z'.codeUnitAt(0) 46 static const int _CC_Z = 90; // 'Z'.codeUnitAt(0)
47 47
48 static int _decodeHex(int c) { 48 static int _decodeHex(int c) {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 344
345 int toInt() => _i; 345 int toInt() => _i;
346 Int32 toInt32() => this; 346 Int32 toInt32() => this;
347 Int64 toInt64() => new Int64.fromInt(_i); 347 Int64 toInt64() => new Int64.fromInt(_i);
348 348
349 String toString() => _i.toString(); 349 String toString() => _i.toString();
350 String toHexString() => _i.toRadixString(16); 350 String toHexString() => _i.toRadixString(16);
351 String toRadixString(int radix) => _i.toRadixString(radix); 351 String toRadixString(int radix) => _i.toRadixString(radix);
352 } 352 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698