js/src/jit-test/tests/ion/bug889451.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/ion/bug889451.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,18 @@
     1.4 +/*
     1.5 +js> (((-1 >>> 1) + 1) * Math.pow(2, 52 - 30) + 1) & 1         
     1.6 +0
     1.7 +js> (((-1 >> 1) + 1) * Math.pow(2, 52 - 30) + 1) & 1 
     1.8 +1
     1.9 +*/
    1.10 + 
    1.11 +function f(x) {
    1.12 +  if (x >= 0) {
    1.13 +    // if it does not fail, try with lower power of 2.
    1.14 +    return (((x >>> 1) + 1) * 4194304 /* 2 ** (52 - 30) */ + 1) & 1;
    1.15 +  }
    1.16 +  return 2;
    1.17 +}
    1.18 + 
    1.19 +assertEq(f(-1 >>> 1), 1);
    1.20 +assertEq(f(-1 >>> 0), 0);
    1.21 +assertEq(f(-1 >>> 0), 0);

mercurial