Difference for common/arch.c from version 1.37 to 1.38


version 1.37 version 1.38
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_arch_c =   * static char *rcsid_arch_c =
  *   "$Id: arch.c,v 1.37 2006/02/10 23:59:25 akirschbaum Exp $";   *   "$Id: arch.c,v 1.38 2006/03/16 21:54:36 akirschbaum Exp $";
  */   */
   
 /*  /*
Line 636
 
Line 636
 hasharch(const char *str, int tablesize) {  hasharch(const char *str, int tablesize) {
     unsigned long hash = 0;      unsigned long hash = 0;
     int i = 0;      int i = 0;
     unsigned rot = 0;      const unsigned char *p;
     const char *p;  
   
       /* use the one-at-a-time hash function, which supposedly is
        * better than the djb2-like one used by perl5.005, but
        * certainly is better then the bug used here before.
        * see http://burtleburtle.net/bob/hash/doobs.html
        */
     for (p = str; i < MAXSTRING && *p; p++, i++) {      for (p = str; i < MAXSTRING && *p; p++, i++) {
         hash ^= (unsigned long) *p << rot;          hash += *p;
         rot += 2;          hash += hash << 10;
         if (rot >= (sizeof(long) - sizeof(char)) * 8)          hash ^= hash >>  6;
             rot = 0;      }
     }      hash += hash <<  3;
     return (hash % tablesize);      hash ^= hash >> 11;
       hash += hash << 15;
       return hash % tablesize;
 }  }
   
 /*  /*


Legend:
line(s) removed in v.1.37 
line(s) changed
 line(s) added in v.1.38

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:05