Return-Path: Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Delivered-To: mailing list dev@apr.apache.org Received: (qmail 65206 invoked from network); 2 Jan 2001 02:08:00 -0000 Received: from 3ff8faf3.dsl.flashcom.net (HELO koj.covalent.net) (63.248.250.243) by h31.sny.collab.net with SMTP; 2 Jan 2001 02:08:00 -0000 Received: from rbb (helo=localhost) by koj.covalent.net with local-esmtp (Exim 3.16 #1) id 14DGv6-0004mL-00; Mon, 01 Jan 2001 18:11:24 -0800 Date: Mon, 1 Jan 2001 18:11:24 -0800 (PST) From: rbb@covalent.net X-Sender: rbb@koj To: David Reid cc: APR Development List , chasan@acm.org Subject: Re: Hash? In-Reply-To: <017e01c0745f$348d1430$011aa8c0@godzilla> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N > 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 :) > */ > 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; Ummmm, those aren't equal. :-) I seem to remember that Tony had a very good reason for choosing (hash * 33). We seem to have had this conversation in the past on new-httpd. I would need to search the archives, which is not easy right now. I believe Tony is not monitoring this list right now, but I'll try to get an answer from him tomorrow. Ryan _______________________________________________________________________________ Ryan Bloom rbb@apache.org 406 29th St. San Francisco, CA 94131 -------------------------------------------------------------------------------