From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: Daniel Berlin Cc: Jim Blandy , gdb-patches@sources.redhat.com Subject: Re: Rewriting the type system Date: Tue, 12 Jun 2001 14:03:00 -0000 Message-id: <3B2683A7.9020508@cygnus.com> References: <3B212FC8.6010801@cygnus.com> <87vgm6snjf.fsf@cgsoftware.com> <87d78aluw6.fsf@cgsoftware.com> X-SW-Source: 2001-06/msg00242.html > Hell, the simple bcache change i submitted last year (updating the > starting constant, fix the indenting) still hasn't > been reviewed. This patch? I'm suprized you didn't take the initiative here and check it in as an obvious fix. Andrew > Index: bcache.c > =================================================================== > RCS file: /cvs/src/src/gdb/bcache.c,v > retrieving revision 1.4 > diff -c -3 -p -r1.4 bcache.c > *** bcache.c 2000/06/05 20:49:53 1.4 > --- bcache.c 2000/12/08 05:01:18 > *************** > *** 28,51 **** > #include "bcache.h" > #include "gdb_string.h" /* For memcpy declaration */ > > ! /* The old hash function was stolen from SDBM. This is what DB 3.0 uses now, > * and is better than the old one. > */ > > unsigned long > hash(void *addr, int length) > { > ! const unsigned char *k, *e; > ! unsigned long h; > ! > ! k = (const unsigned char *)addr; > ! e = k+length; > ! for (h=0; k< e;++k) > ! { > ! h *=16777619; > ! h ^= *k; > ! } > ! return (h); > } > > /* Growing the bcache's hash table. */ > --- 28,55 ---- > #include "bcache.h" > #include "gdb_string.h" /* For memcpy declaration */ > > ! /* The old hash function was stolen from SDBM. This is what DB 3.1 uses now, > * and is better than the old one. > + * It's the Foller/Noll/Vo hash code, for those who care. > */ > + #define FNV0_32_INIT (0) /* To use FNV-0, not recommended */ > + #define FNV1_32_INIT (0x811c9dc5) > + #define FNV_32_PRIME (0x01000193) > > unsigned long > hash(void *addr, int length) > { > ! const unsigned char *k, *e; > ! unsigned long h=FNV1_32_INIT; > ! > ! k = (const unsigned char *)addr; > ! e = k+length; > ! for (; k< e;++k) > ! { > ! h *= FNV_32_PRIME; > ! h ^= *k; > ! } > ! return (h); > } > > /* Growing the bcache's hash table. */ > > >