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

Side by Side Diff: src/js/math.js

Issue 1461133003: Fix typo in MathRandomRaw. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
« 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 "use strict"; 6 "use strict";
7 7
8 %CheckIsBootstrapping(); 8 %CheckIsBootstrapping();
9 9
10 // ------------------------------------------------------------------- 10 // -------------------------------------------------------------------
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 rngstate.b = r0 >>> 16; 141 rngstate.b = r0 >>> 16;
142 rngstate.c = r1 & 0xFFFF; 142 rngstate.c = r1 & 0xFFFF;
143 rngstate.d = r1 >>> 16; 143 rngstate.d = r1 >>> 16;
144 var r = r0 ^ r1; 144 var r = r0 ^ r1;
145 // Construct a double number 1.<32-bits of randomness> and subtract 1. 145 // Construct a double number 1.<32-bits of randomness> and subtract 1.
146 return %_ConstructDouble(0x3FF00000 | (r & 0x000FFFFF), r & 0xFFF00000) - 1; 146 return %_ConstructDouble(0x3FF00000 | (r & 0x000FFFFF), r & 0xFFF00000) - 1;
147 } 147 }
148 148
149 function MathRandomRaw() { 149 function MathRandomRaw() {
150 var r0 = (MathImul(18030, rngstate.a) + rngstate.b) | 0; 150 var r0 = (MathImul(18030, rngstate.a) + rngstate.b) | 0;
151 var r1 = (MathImul(36969, rngstate.d) + rngstate.c) | 0; 151 var r1 = (MathImul(36969, rngstate.c) + rngstate.d) | 0;
152 rngstate.a = r0 & 0xFFFF; 152 rngstate.a = r0 & 0xFFFF;
153 rngstate.b = r0 >>> 16; 153 rngstate.b = r0 >>> 16;
154 rngstate.c = r1 & 0xFFFF; 154 rngstate.c = r1 & 0xFFFF;
155 rngstate.d = r1 >>> 16; 155 rngstate.d = r1 >>> 16;
156 var r = r0 ^ r1; 156 var r = r0 ^ r1;
157 return r & 0x3FFFFFFF; 157 return r & 0x3FFFFFFF;
158 } 158 }
159 159
160 // ECMA 262 - 15.8.2.15 160 // ECMA 262 - 15.8.2.15
161 function MathRound(x) { 161 function MathRound(x) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 utils.Export(function(to) { 353 utils.Export(function(to) {
354 to.MathAbs = MathAbs; 354 to.MathAbs = MathAbs;
355 to.MathExp = MathExp; 355 to.MathExp = MathExp;
356 to.MathFloor = MathFloorJS; 356 to.MathFloor = MathFloorJS;
357 to.IntRandom = MathRandomRaw; 357 to.IntRandom = MathRandomRaw;
358 to.MathMax = MathMax; 358 to.MathMax = MathMax;
359 to.MathMin = MathMin; 359 to.MathMin = MathMin;
360 }); 360 });
361 361
362 }) 362 })
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