From owner-freebsd-hackers Fri Apr 25 22:49:28 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id WAA07359 for hackers-outgoing; Fri, 25 Apr 1997 22:49:28 -0700 (PDT) Received: from root.com (implode.root.com [198.145.90.17]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id WAA07354 for ; Fri, 25 Apr 1997 22:49:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by root.com (8.8.5/8.6.5) with SMTP id WAA19596; Fri, 25 Apr 1997 22:50:44 -0700 (PDT) Message-Id: <199704260550.WAA19596@root.com> X-Authentication-Warning: implode.root.com: localhost [127.0.0.1] didn't use HELO protocol To: "Daniel C. Sobral" cc: hackers@hub.freebsd.org Subject: Re: namei & hash functions In-reply-to: Your message of "Fri, 25 Apr 1997 18:41:04 -0300." <199704252142.SAA04687@gns.com.br> From: David Greenman Reply-To: dg@root.com Date: Fri, 25 Apr 1997 22:50:44 -0700 Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> Index: vfs_lookup.c >> =================================================================== >> RCS file: /jaz/cvs/src/sys/kern/vfs_lookup.c,v >> retrieving revision 1.11.4.1 >> diff -r1.11.4.1 vfs_lookup.c >> 271a272 >> > u_long hash; >> 299c300 >> < cnp->cn_hash = 0; >> - --- >> > hash = 0; >> 301c302,303 >> < cnp->cn_hash += (unsigned char)*cp; >> - --- >> > hash = hash * 33 + (unsigned char)*cp; > >I think hash += hash << 5 + (unsigned char)*cp; >would be better... > >> > cnp->cn_hash = hash; Only the bottom so-many bits are going to be involved in the hash index. I think you lose too much by shifting useful bits off the end. -DG David Greenman Core-team/Principal Architect, The FreeBSD Project