This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: Rewriting the type system
> 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. */
>
>
>