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)
|
putc(7)
|
||||||
end
|
end
|
||||||
|
|
||||||
beep
|
def sieve#0
|
||||||
//for iter = 1 to 10
|
beep
|
||||||
flag = heapalloc(sizepl)
|
//for iter = 1 to 10
|
||||||
memset(flag, TRUE, sizepl)
|
flag = heapalloc(sizepl)
|
||||||
count = 0
|
memset(flag, TRUE, sizepl)
|
||||||
for i = 0 to size
|
count = 0
|
||||||
if flag->[i]
|
for i = 0 to size
|
||||||
prime = i + i + 3
|
if flag->[i]
|
||||||
k = i + prime
|
prime = i + i + 3
|
||||||
while k <= size
|
k = i + prime
|
||||||
flag->[k] = FALSE
|
while k <= size
|
||||||
k = k + prime
|
flag->[k] = FALSE
|
||||||
loop
|
k = k + prime
|
||||||
count = count + 1
|
loop
|
||||||
puti(prime)
|
count = count + 1
|
||||||
putln
|
puti(prime)
|
||||||
fin
|
putln
|
||||||
next
|
fin
|
||||||
//next
|
next
|
||||||
beep
|
//next
|
||||||
|
beep
|
||||||
|
end
|
||||||
|
|
||||||
|
sieve
|
||||||
puti(count)
|
puti(count)
|
||||||
puts(" primes.\n")
|
puts(" primes.\n")
|
||||||
done
|
done
|
||||||
|
@ -59,7 +59,7 @@ word syscmdln
|
|||||||
word = @execmod, @open, @close, @read, @write
|
word = @execmod, @open, @close, @read, @write
|
||||||
byte perr
|
byte perr
|
||||||
byte jitcount = 45
|
byte jitcount = 45
|
||||||
byte jitsize = 128
|
byte jitsize = 255
|
||||||
//
|
//
|
||||||
// Working input buffer overlayed with strings table
|
// Working input buffer overlayed with strings table
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user