04/07/05 01:37 o/9mlWPU
>>241を改良してみた。
; 素数判定 with HSP 何気に高速版
title "素数判定 - Calculating..."
#const MAX_COUNT 1000
ll_libload dll,"kernel32.dll" :ll_getproc func,"GetTickCount", dll
ll_libfree dll :ll_retset refunc
sdim log, 7 * MAX_COUNT :notesel log
dim result, MAX_COUNT
mesbox log, 640, 480
noteadd "2",0,1 :result.0 = 2 :count = 3 :i = 1
;測定
ll_callfunc temp,0,func
start = refunc
repeat
flg = 1;
repeat i
if count \ result.cnt = 0 : flg = 0 :break
loop
if flg {
noteadd ""+count, -1 :result.i = count
i++ :if i >= MAX_COUNT: break
await
}
count += 2
loop
ll_callfunc temp,0,func
refunc -= start :dialog "" + refunc + "ms"
objprm 0, log :title "素数判定"
stop