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

Side by Side Diff: test/mjsunit/asm/word32ror.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/word32and.js ('k') | test/mjsunit/asm/zero-extend.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 rol = (function Module(stdlib, foreign, heap) { 9 var rol = (function Module(stdlib, foreign, heap) {
10 "use asm"; 10 "use asm";
11 function rol(x, y) { 11 function rol(x, y) {
12 x = x | 0; 12 x = x | 0;
13 y = y | 0; 13 y = y | 0;
14 return (x << y) | (x >>> (32 - y)); 14 return (x << y) | (x >>> (32 - y)) | 0;
15 } 15 }
16 return { rol: rol }; 16 return { rol: rol };
17 })(stdlib, foreign, heap).rol; 17 })(stdlib, foreign, heap).rol;
18 18
19 assertEquals(10, rol(10, 0)); 19 assertEquals(10, rol(10, 0));
20 assertEquals(2, rol(1, 1)); 20 assertEquals(2, rol(1, 1));
21 assertEquals(0x40000000, rol(1, 30)); 21 assertEquals(0x40000000, rol(1, 30));
22 assertEquals(-0x80000000, rol(1, 31)); 22 assertEquals(-0x80000000, rol(1, 31));
23 23
24 var ror = (function Module(stdlib, foreign, heap) { 24 var ror = (function Module(stdlib, foreign, heap) {
25 "use asm"; 25 "use asm";
26 function ror(x, y) { 26 function ror(x, y) {
27 x = x | 0; 27 x = x | 0;
28 y = y | 0; 28 y = y | 0;
29 return (x << (32 - y)) | (x >>> y); 29 return (x << (32 - y)) | (x >>> y) | 0;
30 } 30 }
31 return { ror: ror }; 31 return { ror: ror };
32 })(stdlib, foreign, heap).ror; 32 })(stdlib, foreign, heap).ror;
33 33
34 assertEquals(10, ror(10, 0)); 34 assertEquals(10, ror(10, 0));
35 assertEquals(-0x80000000, ror(1, 1)); 35 assertEquals(-0x80000000, ror(1, 1));
36 assertEquals(0x40000000, ror(1, 2)); 36 assertEquals(0x40000000, ror(1, 2));
37 assertEquals(2, ror(1, 31)); 37 assertEquals(2, ror(1, 31));
OLDNEW
« no previous file with comments | « test/mjsunit/asm/word32and.js ('k') | test/mjsunit/asm/zero-extend.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698