flat assembler
Message board for the users of flat assembler.
Index
> Windows > example - small prime finder Goto page Previous 1, 2 |
Author |
|
bitRAKE 30 Sep 2008, 05:22
A bit sieve is very fast to generate and access:
Code: mov edi,sieve xor ecx,ecx .0: bt [edi],ecx inc ecx jnc .0 ; ECX*2 + 1 is prime number (P) lea eax,[ecx*2+2] mul ecx ; (P+1)*(P-1)/2 dec eax ; exit if out of range cmp eax,MAX_BITS jnc .x ; clear bits representing odd multiples of (P) .1: btr [edi],eax lea eax,[eax+ecx*2+1] cmp eax,MAX_BITS jc .1 jmp .0 MAX_BITS = 1 shl 24 ; if bit(n) then (2*n+3) is prime sieve db MAX_BITS/8 dup (-1) .x: _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
30 Sep 2008, 05:22 |
|
SolidThink 16 Oct 2009, 16:07
help me !
I set PSELEND = 17894471 I would start the program automatically unless the push button start, but do not understand where I have to make code changes. : Cry: simplifying .... to do a single loop with PSELEND = 17894471 and then exits automatically when calculation has finished. it's possible ? ;cmp [wparam],BN_CLICKED shl 16 + ID_START ;je btnnone this code run "START" ? |
|||
16 Oct 2009, 16:07 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.