On Fri, Jul 8, 2011 at 1:47 PM, David Miller [off-list ref] wrote:
From: Martin Mares <mj@ucw.cz>
Date: Fri, 8 Jul 2011 19:40:55 +0200
quoted
The hash function is linear, so it can be reduced to:
a = key ^ dev->ifindex
return (a >> 8) ^ (a >> 16) ^ (a >> 24) // (1)
^ (hash_rnd >> 8) ^ (hash_rnd >> 16) ^ (hash_rnd >> 24) // (2)
Is this really the same? The inclusion of a full 32-bit xor
with hash_rnd before folding was intentional, so that the
final folding occurs on a completely "random" value.
Martin's reduction looks exactly correct to me.
-John