blob: 1849f9da2fb2b351b06fb76df97ce119b01d631f [file] [log] [blame]
<!DOCTYPE html>
<head>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>SunSpider bitops-nsieve-bits</title>
</head>
<body>
<h3>bitops-nsieve-bits</h3>
<div id="console">
</div>
<script>
var _sunSpiderStartDate = new Date();
// The Great Computer Language Shootout
// http://shootout.alioth.debian.org
//
// Contributed by Ian Osgood
function pad(n,width) {
var s = n.toString();
while (s.length < width) s = ' ' + s;
return s;
}
function primes(isPrime, n) {
var i, count = 0, m = 10000<<n, size = m+31>>5;
for (i=0; i<size; i++) isPrime[i] = 0xffffffff;
for (i=2; i<m; i++)
if (isPrime[i>>5] & 1<<(i&31)) {
for (var j=i+i; j<m; j+=i)
isPrime[j>>5] &= ~(1<<(j&31));
count++;
}
}
function sieve() {
for (var i = 4; i <= 4; i++) {
var isPrime = new Array((10000<<i)+31>>5);
primes(isPrime, i);
}
}
sieve();
var _sunSpiderInterval = new Date() - _sunSpiderStartDate;
document.getElementById("console").innerHTML = _sunSpiderInterval;
</script>
</body>
</html>