home bbs files messages ]

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

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

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

   Message 2,647 of 2,978   
   Wolfgang Ehrhardt to MobyGamer@gmail.com   
   Re: Possible to inline this code?   
   05 Jun 08 17:16:17   
   
   f5b0174e   
   From: Wolfgang.Ehrhardt.PLEASE.REMOVE@munich.netsurf.de   
      
   On Wed, 4 Jun 2008 14:52:57 -0700 (PDT), Jim Leonard   
    wrote:   
      
   >On Jun 4, 11:27 am, Wolfgang.Ehrhardt.PLEASE.REM...@munich.netsurf.de   
   >(Wolfgang Ehrhardt) wrote:   
   >> If you want real speed, setup a (global) lookup table   
   >>   
   >> const Nibbles: array[byte] of char =  '012345...'   
   >   
   >Nope, that's both larger and slower than what I posted.  It is   
   >impossible to beat my code in size or speed for my target platform   
   >(8088/8086)... although you're welcome to try :-)   
      
   So why do you complain about missing speed if your code is the fastet   
   possible? :)   
      
   Assuming the byte to be converted already in al, your code with inline   
   will generate   
      
   push  ax     11   
   pop   ax      8   
   cmp al,10     4   
   sbb al,69h    4   
   das           4   
      
   with a total of 31 cycles on a 8086 (if I looked up correctly). The   
   global array code will generate   
      
   xor  ah,ah                       3   
   mov  di,ax                       2   
   mov  al,[di+offset nibbles]     10   
      
   which is less than half of the inline code. Not to mention the   
   implicit error detection possibility if the input is greater than 15   
   (just set nibbles[i]:='?' for i>15).   
      
   Wolfgang   
      
   --   
   In order to e-mail me a reply to this message, you will have   
   to remove PLEASE.REMOVE from the address shown in the header   
   or get it from http://home.netsurf.de/wolfgang.ehrhardt   
   (Free open source Crypto, AES, CRC, Hash for Pascal/Delphi)   
      
   --- 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