Thread (17 messages) 17 messages, 10 authors, 2009-02-18

Re: [PATCH] Update jhash.h with the new version of Jenkins' hash

flat view

From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: 2009-02-11 23:23:51
Also in: lkml, netfilter-devel

On Wed, Feb 11, 2009 at 11:50:38PM +0100, Jozsef Kadlecsik wrote:
On Wed, 11 Feb 2009, Micha? Miros?aw wrote:
quoted
On Wed, Feb 11, 2009 at 11:19:20AM +0100, Jozsef Kadlecsik wrote:
quoted
 /* The golden ration: an arbitrary value */
-#define JHASH_GOLDEN_RATIO	0x9e3779b9
+#define JHASH_GOLDEN_RATIO	0xdeadbeef
I have a stupid question: if this is arbitrary value, then why not
just get rid of it (IOW use zero as it's used in addition)?
lookup3() is a quite generic hash function and it supports 0-byte strings 
as input keys too. If the input key is a 0-byte string and the arbitrary 
value is zero, then the hash value simply equal to the initval. In order 
to avoid that case, the arbitrary value must be nonzero.
Double-hashing, of course! I really need more sleep. Sorry for the noise. :>

Best Regards,
Michał Mirosław
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help