/drivers/include/linux/hash.h |
---|
36,6 → 36,9 |
{ |
u64 hash = val; |
#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 |
hash = hash * GOLDEN_RATIO_PRIME_64; |
#else |
/* Sigh, gcc can't optimise this alone like it does for 32 bits. */ |
u64 n = hash; |
n <<= 18; |
50,6 → 53,7 |
hash += n; |
n <<= 2; |
hash += n; |
#endif |
/* High bits are more random, so use them. */ |
return hash >> (64 - bits); |
78,4 → 82,5 |
#endif |
return (u32)val; |
} |
#endif /* _LINUX_HASH_H */ |