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 logical 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 function testShiftRightLogical()
8 {
9 var r = [];
10 var i = 0;
11 var j = 0;
13 var shifts = [0,1,7,8,15,16,23,24,31];
15 /* Samples from the simple shift range. */
16 for (i = 0; i < shifts.length; i++)
17 r[j++] = -2147483648 >>> shifts[i];
19 /* Samples outside the normal shift range. */
20 for (i = 0; i < shifts.length; i++)
21 r[j++] = -2147483648 >>> (shifts[i] + 32);
23 /* Samples far outside the normal shift range. */
24 for (i = 0; i < shifts.length; i++)
25 r[j++] = -2147483648 >>> (shifts[i] + 224);
26 for (i = 0; i < shifts.length; i++)
27 r[j++] = -2147483648 >>> (shifts[i] + 256);
29 return r.join(",");
30 }
31 /* Note: Arguments to the ">>>" operator are converted to unsigned 32-bit
32 * integers during evaluation. As a result, -2147483648 >>> 0 evaluates to the
33 * unsigned interpretation of the same value, which is 2147483648. */
34 assertEq(testShiftRightLogical(),
35 "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+
36 "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+
37 "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+
38 "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1");