michael@0: /* Test the proper operation of the logical right shift operator. This is michael@0: * especially important on ARM as an explicit mask is required at the native michael@0: * instruction level. */ michael@0: michael@0: load(libdir + 'range.js'); michael@0: michael@0: function testShiftRightLogical() michael@0: { michael@0: var r = []; michael@0: var i = 0; michael@0: var j = 0; michael@0: michael@0: var shifts = [0,1,7,8,15,16,23,24,31]; michael@0: michael@0: /* Samples from the simple shift range. */ michael@0: for (i = 0; i < shifts.length; i++) michael@0: r[j++] = -2147483648 >>> shifts[i]; michael@0: michael@0: /* Samples outside the normal shift range. */ michael@0: for (i = 0; i < shifts.length; i++) michael@0: r[j++] = -2147483648 >>> (shifts[i] + 32); michael@0: michael@0: /* Samples far outside the normal shift range. */ michael@0: for (i = 0; i < shifts.length; i++) michael@0: r[j++] = -2147483648 >>> (shifts[i] + 224); michael@0: for (i = 0; i < shifts.length; i++) michael@0: r[j++] = -2147483648 >>> (shifts[i] + 256); michael@0: michael@0: return r.join(","); michael@0: } michael@0: /* Note: Arguments to the ">>>" operator are converted to unsigned 32-bit michael@0: * integers during evaluation. As a result, -2147483648 >>> 0 evaluates to the michael@0: * unsigned interpretation of the same value, which is 2147483648. */ michael@0: assertEq(testShiftRightLogical(), michael@0: "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+ michael@0: "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+ michael@0: "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+ michael@0: "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1");