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

Side by Side Diff: runtime/lib/math_patch.dart

Issue 10883071: - Change "static final" to "static const" in the runtime/ directory. (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
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 // A VM patch of the dart:math library. 5 // A VM patch of the dart:math library.
6 patch int parseInt(String str) => MathNatives.parseInt(str); 6 patch int parseInt(String str) => MathNatives.parseInt(str);
7 patch double parseDouble(String str) => MathNatives.parseDouble(str); 7 patch double parseDouble(String str) => MathNatives.parseDouble(str);
8 patch num pow(num x, num exponent) => MathNatives.pow(x, exponent); 8 patch num pow(num x, num exponent) => MathNatives.pow(x, exponent);
9 patch double atan2(num a, num b) => MathNatives.atan2(a, b); 9 patch double atan2(num a, num b) => MathNatives.atan2(a, b);
10 patch double sin(num x) => MathNatives.sin(x); 10 patch double sin(num x) => MathNatives.sin(x);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 double nextDouble() { 69 double nextDouble() {
70 return ((nextInt(1 << (26)) << 27) + nextInt(1 << 27)) / _POW2_53_D; 70 return ((nextInt(1 << (26)) << 27) + nextInt(1 << 27)) / _POW2_53_D;
71 } 71 }
72 72
73 bool nextBool() { 73 bool nextBool() {
74 return nextInt(1) == 0; 74 return nextInt(1) == 0;
75 } 75 }
76 76
77 // Constants used by the algorithm or masking. 77 // Constants used by the algorithm or masking.
78 static final _MASK_32 = (1 << 32) - 1; 78 static const _MASK_32 = (1 << 32) - 1;
79 static final _MASK_64 = (1 << 64) - 1; 79 static const _MASK_64 = (1 << 64) - 1;
80 static final _POW2_32 = 1 << 32; 80 static const _POW2_32 = 1 << 32;
81 static final _POW2_53_D = 1.0 * (1 << 53); 81 static const _POW2_53_D = 1.0 * (1 << 53);
82 82
83 static final _A = 0xffffda61; 83 static const _A = 0xffffda61;
84 84
85 // Use a singleton Random object to get a new seed if no seed was passed. 85 // Use a singleton Random object to get a new seed if no seed was passed.
86 static var _prng = null; 86 static var _prng = null;
87 87
88 static int _nextSeed() { 88 static int _nextSeed() {
89 if (_prng == null) { 89 if (_prng == null) {
90 // TODO(iposva): Use system to get a random seed. 90 // TODO(iposva): Use system to get a random seed.
91 _prng = new Random(new Date.now().millisecondsSinceEpoch); 91 _prng = new Random(new Date.now().millisecondsSinceEpoch);
92 } 92 }
93 // Trigger the PRNG once to change the internal state. 93 // Trigger the PRNG once to change the internal state.
94 _prng._nextInt32(); 94 _prng._nextInt32();
95 return _prng._state; 95 return _prng._state;
96 } 96 }
97 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698