nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib/mnit: use PRINT_ERROR instead of printf on portable code
[nit.git]
/
tests
/
shootout_nsieve.nit
diff --git
a/tests/shootout_nsieve.nit
b/tests/shootout_nsieve.nit
index
0e2542b
..
2137a3a
100644
(file)
--- a/
tests/shootout_nsieve.nit
+++ b/
tests/shootout_nsieve.nit
@@
-14,18
+14,18
@@
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
-meth nsieve(n: Int): Int
+fun nsieve(n: Int): Int
do
var count = 0
do
var count = 0
- var array = new Buffer.with_capacity(n)
+ var array: Buffer = new FlatBuffer.with_capacity(n)
for i in [0..n[ do
for i in [0..n[ do
- array[i] = 'o'
+ array.chars[i] = 'o'
end
for i in [2..n[ do
end
for i in [2..n[ do
- if array[i] == 'o' then
+ if array.chars[i] == 'o' then
var j = i * 2
while j < n do
var j = i * 2
while j < n do
- array[j] = 'x'
+ array.chars[j] = 'x'
j = j + i
end
count = count + 1
j = j + i
end
count = count + 1
@@
-34,7
+34,7
@@
do
return count
end
return count
end
-meth test(n: Int)
+fun test(n: Int)
do
var m = 10000.lshift(n)
print("Primes up to {m} {nsieve(m)}")
do
var m = 10000.lshift(n)
print("Primes up to {m} {nsieve(m)}")