Difference between revisions of "CSC231 Homework 10 Solution 2010"

From dftwiki3
Jump to: navigation, search
(Created page with '--~~~~ ---- <onlydft> <code><pre> ; findPrime.asm ; D. Thiebaut ; ; This program counts the number of primes number less than 1,000,000. ; ; This is the optimized version. ; ---…')
 
Line 7: Line 7:
 
; D. Thiebaut
 
; D. Thiebaut
 
;
 
;
; This program counts the number of primes number less than 1,000,000.
+
; this program counts the number of primes number less than 1,000,000.
 
;
 
;
; This is the optimized version.
 
; ----------------------------------
 
 
; to assemble and run:
 
; to assemble and run:
 
;
 
;
Line 87: Line 85:
 
       ja .endFor
 
       ja .endFor
  
.if:  mov edx, 0 ; divide n by i
+
.if:  xor edx,edx ; divide n by i
 
       mov eax, ip_n
 
       mov eax, ip_n
  
Line 95: Line 93:
 
        
 
        
 
.ret0:
 
.ret0:
      mov eax, 0 ; return 0
 
 
       jmp .endIsPrime
 
       jmp .endIsPrime
  
Line 117: Line 114:
  
 
       ret
 
       ret
 +
  
  

Revision as of 00:33, 8 December 2010

--D. Thiebaut 05:29, 8 December 2010 (UTC)



...