Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
1 // The Computer Language Shootout
2 // http://shootout.alioth.debian.org/
3 // contributed by Isaac Gouy
5 function partial(n){
6 var a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0.0;
7 var twothirds = 2.0/3.0;
8 var alt = -1.0;
9 var k2 = k3 = sk = ck = 0.0;
11 /* BEGIN LOOP */
12 for (var k = 1; k <= n; k++){
13 k2 = k*k;
14 k3 = k2*k;
15 sk = Math.sin(k);
16 ck = Math.cos(k);
17 alt = -alt;
19 a1 += Math.pow(twothirds,k-1);
20 a2 += Math.pow(k,-0.5);
21 a3 += 1.0/(k*(k+1.0));
22 a4 += 1.0/(k3 * sk*sk);
23 a5 += 1.0/(k3 * ck*ck);
24 a6 += 1.0/k;
25 a7 += 1.0/k2;
26 a8 += alt/k;
27 a9 += alt/(2*k -1);
28 }
29 /* END LOOP */
30 }
32 /* BEGIN LOOP */
33 for (var i = 1024; i <= 16384; i *= 2) {
34 partial(i);
35 }
36 /* END LOOP */