Date: Fri, 25 Apr 1997 22:50:44 -0700 From: David Greenman <dg@root.com> To: "Daniel C. Sobral" <dcs@gns.com.br> Cc: hackers@hub.freebsd.org Subject: Re: namei & hash functions Message-ID: <199704260550.WAA19596@root.com> In-Reply-To: Your message of "Fri, 25 Apr 1997 18:41:04 -0300." <199704252142.SAA04687@gns.com.br>
next in thread | previous in thread | raw e-mail | index | archive | help
>> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704260550.WAA19596>