Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | function test1(x) { |
michael@0 | 2 | return (x*((2<<23)-1))|0 |
michael@0 | 3 | } |
michael@0 | 4 | function test2(x) { |
michael@0 | 5 | return (x*((2<<22)-1))|0 |
michael@0 | 6 | } |
michael@0 | 7 | function test3(x) { |
michael@0 | 8 | return (x*((2<<21)-1))|0 |
michael@0 | 9 | } |
michael@0 | 10 | function test4(x) { |
michael@0 | 11 | var b = x + x + 3 |
michael@0 | 12 | return (b*b) | 0 |
michael@0 | 13 | } |
michael@0 | 14 | //MAX_INT |
michael@0 | 15 | var x = 0x7ffffffe; |
michael@0 | 16 | assertEq(test1(x), 2113929216); |
michael@0 | 17 | assertEq(test2(x), 2130706434); |
michael@0 | 18 | assertEq(test3(x), 2139095042); |
michael@0 | 19 | assertEq(test4(x), 0); |