mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-10 06:30:41 +00:00
Make SIEVE JITable
This commit is contained in:
parent
3968f82625
commit
148031d192
@ -11,26 +11,30 @@ def beep#0
|
||||
putc(7)
|
||||
end
|
||||
|
||||
beep
|
||||
//for iter = 1 to 10
|
||||
flag = heapalloc(sizepl)
|
||||
memset(flag, TRUE, sizepl)
|
||||
count = 0
|
||||
for i = 0 to size
|
||||
if flag->[i]
|
||||
prime = i + i + 3
|
||||
k = i + prime
|
||||
while k <= size
|
||||
flag->[k] = FALSE
|
||||
k = k + prime
|
||||
loop
|
||||
count = count + 1
|
||||
puti(prime)
|
||||
putln
|
||||
fin
|
||||
next
|
||||
//next
|
||||
beep
|
||||
def sieve#0
|
||||
beep
|
||||
//for iter = 1 to 10
|
||||
flag = heapalloc(sizepl)
|
||||
memset(flag, TRUE, sizepl)
|
||||
count = 0
|
||||
for i = 0 to size
|
||||
if flag->[i]
|
||||
prime = i + i + 3
|
||||
k = i + prime
|
||||
while k <= size
|
||||
flag->[k] = FALSE
|
||||
k = k + prime
|
||||
loop
|
||||
count = count + 1
|
||||
puti(prime)
|
||||
putln
|
||||
fin
|
||||
next
|
||||
//next
|
||||
beep
|
||||
end
|
||||
|
||||
sieve
|
||||
puti(count)
|
||||
puts(" primes.\n")
|
||||
done
|
||||
|
@ -59,7 +59,7 @@ word syscmdln
|
||||
word = @execmod, @open, @close, @read, @write
|
||||
byte perr
|
||||
byte jitcount = 45
|
||||
byte jitsize = 128
|
||||
byte jitsize = 255
|
||||
//
|
||||
// Working input buffer overlayed with strings table
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user