26 #include <linux/bitops.h>
30 #define jhash_size(n) ((u32)1<<(n))
32 #define jhash_mask(n) (jhash_size(n)-1)
35 #define __jhash_mix(a, b, c) \
37 a -= c; a ^= rol32(c, 4); c += b; \
38 b -= a; b ^= rol32(a, 6); a += c; \
39 c -= b; c ^= rol32(b, 8); b += a; \
40 a -= c; a ^= rol32(c, 16); c += b; \
41 b -= a; b ^= rol32(a, 19); a += c; \
42 c -= b; c ^= rol32(b, 4); b += a; \
46 #define __jhash_final(a, b, c) \
48 c ^= b; c -= rol32(b, 14); \
49 a ^= c; a -= rol32(c, 11); \
50 b ^= a; b -= rol32(a, 25); \
51 c ^= b; c -= rol32(b, 16); \
52 a ^= c; a -= rol32(c, 4); \
53 b ^= a; b -= rol32(a, 14); \
54 c ^= b; c -= rol32(b, 24); \
58 #define JHASH_INITVAL 0xdeadbeef
80 a += __get_unaligned_cpu32(k);
81 b += __get_unaligned_cpu32(k + 4);
82 c += __get_unaligned_cpu32(k + 8);
90 case 12: c += (
u32)k[11]<<24;
91 case 11: c += (
u32)k[10]<<16;
92 case 10: c += (
u32)k[9]<<8;
94 case 8: b += (
u32)k[7]<<24;
95 case 7: b += (
u32)k[6]<<16;
96 case 6: b += (
u32)k[5]<<8;
98 case 4: a += (
u32)k[3]<<24;
99 case 3: a += (
u32)k[2]<<16;
100 case 2: a += (
u32)k[1]<<8;
160 static inline u32 jhash_2words(
u32 a,
u32 b,
u32 initval)
162 return jhash_3words(a, b, 0, initval);
165 static inline u32 jhash_1word(
u32 a,
u32 initval)
167 return jhash_3words(a, 0, 0, initval);