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 /*
2 js> (((-1 >>> 1) + 1) * Math.pow(2, 52 - 30) + 1) & 1
3 0
4 js> (((-1 >> 1) + 1) * Math.pow(2, 52 - 30) + 1) & 1
5 1
6 */
8 function f(x) {
9 if (x >= 0) {
10 // if it does not fail, try with lower power of 2.
11 return (((x >>> 1) + 1) * 4194304 /* 2 ** (52 - 30) */ + 1) & 1;
12 }
13 return 2;
14 }
16 assertEq(f(-1 >>> 1), 1);
17 assertEq(f(-1 >>> 0), 0);
18 assertEq(f(-1 >>> 0), 0);