From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758186AbZBKWux (ORCPT ); Wed, 11 Feb 2009 17:50:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754892AbZBKWul (ORCPT ); Wed, 11 Feb 2009 17:50:41 -0500 Received: from smtp-in.kfki.hu ([148.6.0.28]:32782 "EHLO smtp2.kfki.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754664AbZBKWuk (ORCPT ); Wed, 11 Feb 2009 17:50:40 -0500 Date: Wed, 11 Feb 2009 23:50:38 +0100 (CET) From: Jozsef Kadlecsik To: =?ISO-8859-2?Q?Micha=B3_Miros=B3aw?= cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, Rusty Russell Subject: Re: [PATCH] Update jhash.h with the new version of Jenkins' hash In-Reply-To: <20090211201908.GA25398@rere.qmqm.pl> Message-ID: References: <20090211201908.GA25398@rere.qmqm.pl> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Feb 2009, Micha? Miros?aw wrote: > On Wed, Feb 11, 2009 at 11:19:20AM +0100, Jozsef Kadlecsik wrote: > > /* 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. Best regards, Jozsef - E-mail : kadlec@blackhole.kfki.hu, kadlec@mail.kfki.hu PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt Address : KFKI Research Institute for Particle and Nuclear Physics H-1525 Budapest 114, POB. 49, Hungary