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. */
16 function testShiftRightArithmetic()
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);
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");