repo.or.cz
/
cslatevm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Unit and benchmark test usage of ::= and :=.
[cslatevm.git]
/
tests
/
benchmark
/
nsievebits.slate
blob
24e382c6490c3e1285d27bf23465c37be930657a
1
2
m@(Integer traits) nsievebits
3
[| count |
4
count := 0.
5
(isPrime ::= BitArray new &capacity: m + 1) atAllPut: True.
6
2 to: m do:
7
[| :i |
8
(isPrime at: i) ifTrue:
9
[(i + i to: m by: i) do: [| :k | isPrime at: k put: False].
10
count += 1]].
11
count
12
].
13
14
n@(Integer traits) bitprimes
15
[
16
m ::= (2 raisedTo: n) * 10000.
17
m nsievebits
18
].