Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Test the proper operation of the arithmetic right shift operator. This is
2 * especially important on ARM as an explicit mask is required at the native
3 * instruction level. */
5 load(libdir + 'range.js');
7 /* Test different combinations of literals/variables. */
8 var s = 4;
9 var t = 100;
10 assertEq(42 >> s, 2);
11 assertEq(s >> 1, 2);
12 assertEq(23 >> 3, 2);
13 assertEq(t >> s, 6);
16 function testShiftRightArithmetic()
17 {
18 var r = [];
19 var i = 0;
20 var j = 0;
22 var shifts = [0,1,7,8,15,16,23,24,31];
24 /* Samples from the simple shift range. */
25 for (i = 0; i < shifts.length; i++)
26 r[j++] = -2147483648 >> shifts[i];
28 /* Samples outside the normal shift range. */
29 for (i = 0; i < shifts.length; i++)
30 r[j++] = -2147483648 >> (shifts[i] + 32);
32 /* Samples far outside the normal shift range. */
33 for (i = 0; i < shifts.length; i++)
34 r[j++] = -2147483648 >> (shifts[i] + 224);
35 for (i = 0; i < shifts.length; i++)
36 r[j++] = -2147483648 >> (shifts[i] + 256);
38 return r.join(",");
39 }
40 assertEq(testShiftRightArithmetic(),
41 "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
42 "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
43 "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
44 "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1");