Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 1997 18:41:04 -0300 (EST)
From:      "Daniel C. Sobral" <dcs@gns.com.br>
To:        hackers@hub.freebsd.org
Subject:   namei & hash functions
Message-ID:  <199704252142.SAA04687@gns.com.br>
In-Reply-To: <199704250932.CAA04813@hub.freebsd.org> from "owner-hackers-digest@hub.freebsd.org" at "Apr 25, 97 02:32:52 am"

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;

-- 
Daniel C. Sobral		  (8-DCS)
dcs@gns.com.br
dcs@linf.unb.br

The IBM purchase of ROLM gives new meaning to the term "twisted pair".
		-- Howard Anderson, "Yankee Group"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704252142.SAA04687>