home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / nasm20b / nasm_src / hash.c < prev    next >
C/C++ Source or Header  |  1993-01-19  |  1KB  |  39 lines

  1. /* ---------------------------------------------------------------------- */
  2. /*                   Copyright (C) 1991 by Natürlich!                     */
  3. /*                      This file is copyrighted!                         */
  4. /*                Refer to the documentation for details.                 */
  5. /* ---------------------------------------------------------------------- */
  6. #include "defines.h"
  7.  
  8. extern   char  hash_tab[];
  9.  
  10. lword  calc_hash( s)
  11. register char  *s;
  12. {
  13.    register byte     *p = (byte *) hash_tab,
  14.                      c;
  15.    register lword    res;
  16.  
  17.    if( res = p[ *s++])
  18.       if( c = p[ *s++])
  19.       {
  20.          res = (res << 5) | c;
  21.          if( c = p[ *s++])
  22.          {
  23.             res = (res << 5) | c;
  24.             if( c = p[ *s++])
  25.             {
  26.                res = (res << 5) | c;
  27.                if( c = p[ *s++])
  28.                {
  29.                   res = (res << 5) | c;
  30.                   if( c = p[ *s])
  31.                      res = (res << 5) | c;
  32.                }
  33.             }
  34.          }
  35.       }
  36.    return( res);
  37. }
  38.  
  39.