3 <script src=
"../htmlrunner.js"></script>
5 // The Great Computer Language Shootout
6 // http://shootout.alioth.debian.org
8 // Contributed by Ian Osgood
10 function pad(n
,width
) {
12 while (s
.length
< width
) s
= ' ' + s
;
16 function primes(isPrime
, n
) {
17 var i
, count
= 0, m
= 10000<<n
, size
= m
+31>>5;
19 for (i
=0; i
<size
; i
++) isPrime
[i
] = 0xffffffff;
22 if (isPrime
[i
>>5] & 1<<(i
&31)) {
23 for (var j
=i
+i
; j
<m
; j
+=i
)
24 isPrime
[j
>>5] &= ~(1<<(j
&31));
29 window
.onload = function(){ startTest("sunspider-bitops-nsieve-bits", '35973a6b');
33 test( "N-Sieve Bits", function(){
34 var isPrime
= new Array((10000<<i
)+31>>5);