[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090212001223.GA5757@movementarian.org>
Date: Wed, 11 Feb 2009 19:12:23 -0500
From: wli@...ementarian.org
To: Jozsef Kadlecsik <kadlec@...ckhole.kfki.hu>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
netfilter-devel@...r.kernel.org,
Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH] Update jhash.h with the new version of Jenkins' hash
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists