home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,587 of 4,675   
   Robert Prins to All   
   Two-off code in program that runs in abo   
   16 Apr 23 14:21:27   
   
   From: robert@nospicedham.prino.org   
      
   Current code, simplified:   
      
   mov     ecx, 10   
   cdq   
   div     ecx   
   cdq   
   div     ecx   
      
   Equivalent faster, but longer code:   
      
   imul    eax, 0xcccd   
   shr     eax, 19   
   imul    eax, 0xcccd   
   shr     eax, 19   
      
   And yes, as EAX is guaranteed to be small (<= 200) it is equivalent!   
      
   Should I really care, or not? And what would a modern compiler generate?   
      
   Robert   
   --   
   Robert AH Prins   
   robert(a)prino(d)org   
   The hitchhiking grandfather - https://prino.neocities.org/   
   Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca