From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick McHardy Subject: Re: [PATCH] Update jhash.h with the new version of Jenkins' hash Date: Thu, 12 Feb 2009 10:16:39 +0100 Message-ID: <4993E8F7.6070007@trash.net> References: <20090212001223.GA5757@movementarian.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: wli@movementarian.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, Rusty Russell To: Jozsef Kadlecsik Return-path: In-Reply-To: Sender: netdev-owner@vger.kernel.org List-Id: netfilter-devel.vger.kernel.org Jozsef Kadlecsik wrote: > -#define __jhash_mix(a, b, c) \ > +#define __rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) > + > +/* __jhash_mix - mix 3 32-bit values reversibly. */ > +#define __jhash_mix(a,b,c) \ > +{ \ > + a -= c; a ^= __rot(c, 4); c += b; \ > + b -= a; b ^= __rot(a, 6); a += c; \ > + c -= b; c ^= __rot(b, 8); b += a; \ > + a -= c; a ^= __rot(c,16); c += b; \ > + b -= a; b ^= __rot(a,19); a += c; \ > + c -= b; c ^= __rot(b, 4); b += a; \ > +} include/linux/bitops.h includes multiple rot variants. rol32() looks approriate.