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 2,715 of 4,675   
   Rod Pemberton to Terje Mathisen   
   Re: Optimize stricmp() algorithm (casele   
   25 Jun 17 18:02:54   
   
   From: NeedNotReplyHere@nospicedham.xrsevnneqk.cem   
      
   On Sun, 25 Jun 2017 18:41:00 +0200   
   Terje Mathisen  wrote:   
      
   > In almost all languages the number of glyphs that have both uppercase   
   > and lowercase versions is very limited, right?   
   >   
   > I.e. it is probably way less than 256 such characters in all the text   
   > you'll ever encounter, this means that a collision-free hash table   
   > can be relatively easily constructed and that can reduce the wide   
   > wtolower() call to hashing the input down to a reasonable number of   
   > bits and then looking it up in the hash table:   
   >   
   > Each hash table entry will contain the character that you are looking   
   > up, along with its lowercase equivalent, so the code will look like   
   > this:   
   >   
   > int wtolower(int c)   
   > {   
   >    unsigned h = hash(c) & TABLE_MASK;   
   >    if (lowertable[h].ch == c)   
   >      c = lowertable[h].lo;   
   >    return c;   
   > }   
   >   
   > This function is still so expensive that Rod's optimization makes   
   > perfect sense but it should reduce each wtolower() call to the cost   
   > of a branch miss, more or less.   
   >   
      
   This brings to mind the concept of a rolling hash.   
   https://en.wikipedia.org/wiki/Rolling_hash   
      
      
   Rod Pemberton   
   --   
   The entire idea that the U.S. government obtained information from deep   
   sources in the Russian government that Putin ordered a cyber campaign   
   to disrupt our democracy is itself dezinformatsiya.  Wake up sheeple.   
      
   --- 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