Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 1997 19:07:06 -0400
From:      "David S. Miller" <davem@jenolan.rutgers.edu>
To:        dcs@gns.com.br
Cc:        hackers@hub.freebsd.org
Subject:   Re: namei & hash functions
Message-ID:  <199704252307.TAA11256@jenolan.caipgeneral>
In-Reply-To: <199704252142.SAA04687@gns.com.br> (dcs@gns.com.br)

next in thread | previous in thread | raw e-mail | index | archive | help
   From: "Daniel C. Sobral" <dcs@gns.com.br>
   Date: Fri, 25 Apr 1997 18:41:04 -0300 (EST)

   > > 		hash = hash * 33 + (unsigned char)*cp;

   I think		hash += hash << 5 + (unsigned char)*cp;
   would be better...

Not really necessary, GCC can see the constant multiply:

int mul33(int a)
{
	return a * 33;
}

mul33:
	sll %o0,5,%g2
	retl
	add %g2,%o0,%o0

---------------------------------------------////
Yow! 11.26 MB/s remote host TCP bandwidth & ////
199 usec remote TCP latency over 100Mb/s   ////
ethernet.  Beat that!                     ////
-----------------------------------------////__________  o
David S. Miller, davem@caip.rutgers.edu /_____________/ / // /_/ ><



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