From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757295AbZBLAMh (ORCPT ); Wed, 11 Feb 2009 19:12:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754682AbZBLAM1 (ORCPT ); Wed, 11 Feb 2009 19:12:27 -0500 Received: from movementarian.org ([79.99.65.163]:49918 "EHLO movementarian.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753400AbZBLAM0 (ORCPT ); Wed, 11 Feb 2009 19:12:26 -0500 Date: Wed, 11 Feb 2009 19:12:23 -0500 From: wli@movementarian.org To: Jozsef Kadlecsik 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 Message-ID: <20090212001223.GA5757@movementarian.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 The golden ratio is not an arbitrary value, nor is it a food ration. It is (sqrt(5)+1)/2. and the original value of JHASH_GOLDEN_RATIO approximated its reciprocal and/or fractional part in fixed point. (double)0xdeadbeef/((unsigned long long)1 << 32) is a rather poor approximation of (sqrt(5)-1)/2. If this value which is not the golden ratio is arbitrary, calling it something different from JHASH_GOLDEN_RATIO would surprise the code's readers much less. -- wli