Primality by trial division: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 137: | Line 137: | ||
ADDQ.L #1,D4 ;increment the count of proper divisors. |
ADDQ.L #1,D4 ;increment the count of proper divisors. |
||
CMP.L #2,D4 ;is D4 two or greater? |
|||
BCC notPrime ;if so, it's not prime! (Ends early. We'll need to check again if we made it to the end.) |
|||
D2_Wasnt_A_Divisor: |
D2_Wasnt_A_Divisor: |
||
MOVE.L D0,D1 ;restore D1. |
MOVE.L D0,D1 ;restore D1. |
||
ADDQ.L #1,D2 ;increment D2 |
ADDQ.L #1,D2 ;increment D2 |
||
CMP.L D2,D1 ;is D2 now greater than D1? |
CMP.L D2,D1 ;is D2 now greater than D1? |