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 3,467 of 4,675   
   Bernhard Schornak to All   
   Re: Fast Fizz Buzz program   
   19 Jul 18 13:04:47   
   
   From: schornak@nospicedham.web.de   
      
   fizz buzz wrote:   
      
      
      
      
      
   Theoretical thought:   
      
   The inserted FIZZes, BUZZes and FIZZBUZZes always follow the   
   same pattern   
      
   n1   
   n2   
   FIZZ   
   n4   
   BUZZ   
   FIZZ   
   n7   
   n8   
   FIZZ   
   BUZZ   
   n11   
   FIZZ   
   n13   
   n14   
   FIZZBUZZ   
      
      
   Hence, we can save all comparisons regarding replacement and   
   prefill the output buffer with the above pattern as often as   
   required to reach the desired number. If we define a *fixed*   
   output size (e.g.: 8 byte for 6 digit numbers plus line feed   
   plus trailing zero), the above patterns could be loaded into   
   eight XMM registers and moved to the output buffer n/8 times   
   to "bypass" the comparisons completely.   
      
   If we use another fixed pattern for the numbers to print, we   
   can skip the hex to dec translation, as well, and replace it   
   by brute force incrementing zeroes until we reach the nines.   
   Then we just had to increment the next higher digits and re-   
   set the lowest one by zero to repeat until the entire number   
   is processed.   
      
      
   Just my five cents...   
      
   Bernhard Schornak   
      
   --- 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