apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Fogel <kfo...@galois.collab.net>
Subject Re: Hash?
Date Tue, 02 Jan 2001 01:59:09 GMT
"David Reid" <dreid@jetnet.co.uk> writes:
> This was suggested by Carlos Hasan mailto:chasan@acm.org but as I'm not
> overly familiar with the hashing code I'm putting it forward rather than
> committing it :)

Did he offer any particular justification for the change? :-)

I'm not saying it's bad or good, just have no idea why the change is
suggested or how it affects performance.

-K

> Index: tables/apr_hash.c
> ===================================================================
> RCS file: /home/cvs/apr/tables/apr_hash.c,v
> retrieving revision 1.9
> diff -u -r1.9 apr_hash.c
> --- tables/apr_hash.c   2000/11/08 00:54:23     1.9
> +++ tables/apr_hash.c   2001/01/02 01:30:14
> @@ -255,8 +255,9 @@
>       */
>      hash = 0;
>      for (p = key, i = klen; i; i--, p++)
> -       hash = hash * 33 + *p;
> +        hash += (hash << 5) + *p;
> +
>      /* scan linked list */
>      for (hep = &ht->array[hash & ht->max], he = *hep;
>          he;

Mime
View raw message