Thread (17 messages) 17 messages, 10 authors, 2009-02-18

Re: [PATCH] Update jhash.h with the new version of Jenkins' hash

flat view

From: Patrick McHardy <hidden>
Date: 2009-02-12 09:17:07
Also in: lkml, netfilter-devel

Jozsef Kadlecsik wrote:
quoted hunk ↗ jump to hunk
-#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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help