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

Side by Side Diff: test/mjsunit/asm/uint32mod.js

Issue 2663243002: [asm] Fix lots of invalid asm.js tests (Closed)
Patch Set: Rebase Created 3 years, 10 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
« no previous file with comments | « test/mjsunit/asm/uint32div.js ('k') | test/mjsunit/asm/uint32mod-constant.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 var stdlib = {}; 5 var stdlib = {};
6 var foreign = {}; 6 var foreign = {};
7 var heap = new ArrayBuffer(64 * 1024); 7 var heap = new ArrayBuffer(64 * 1024);
8 8
9 var mod = (function Module(stdlib, foreign, heap) { 9 var mod = (function Module(stdlib, foreign, heap) {
10 "use asm"; 10 "use asm";
11 function mod(dividend, divisor) { 11 function mod(dividend, divisor) {
12 dividend = dividend >>> 0; 12 dividend = dividend | 0;
13 divisor = divisor >>> 0; 13 divisor = divisor | 0;
14 return (dividend % divisor) >>> 0; 14 return ((dividend >>> 0) % (divisor >>> 0)) | 0;
15 } 15 }
16 return { mod: mod }; 16 return { mod: mod };
17 })(stdlib, foreign, heap).mod; 17 })(stdlib, foreign, heap).mod;
18 18
19 var divisors = [0, 1, 3, 4, 10, 42, 64, 100, 1024, 2147483647, 4294967295]; 19 var divisors = [0, 1, 3, 4, 10, 42, 64, 100, 1024, 2147483647, 4294967295];
20 for (var i in divisors) { 20 for (var i in divisors) {
21 var divisor = divisors[i]; 21 var divisor = divisors[i];
22 for (var dividend = 0; dividend < 4294967296; dividend += 3999773) { 22 for (var dividend = 0; dividend < 4294967296; dividend += 3999773) {
23 assertEquals((dividend % divisor) >>> 0, mod(dividend, divisor)); 23 assertEquals((dividend % divisor) | 0, mod(dividend, divisor));
24 } 24 }
25 } 25 }
OLDNEW
« no previous file with comments | « test/mjsunit/asm/uint32div.js ('k') | test/mjsunit/asm/uint32mod-constant.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698