summaryrefslogtreecommitdiffstats
path: root/include/linux/hash.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-09-22 11:57:32 -0600
committerJens Axboe <axboe@fb.com>2014-09-22 11:57:32 -0600
commit6d11fb454b161a4565c57be6f1c5527235741003 (patch)
treec238ed3df2f654181c2a0746478a33b32214cc60 /include/linux/hash.h
parentb207892b061da7608878e273ae22ba9bf9be264b (diff)
parent8b95741569eabc5eb17da71d1d3668cdb0bef86c (diff)
downloadlinux-6d11fb454b161a4565c57be6f1c5527235741003.tar.gz
linux-6d11fb454b161a4565c57be6f1c5527235741003.tar.bz2
linux-6d11fb454b161a4565c57be6f1c5527235741003.zip
Merge branch 'for-linus' into for-3.18/core
Moving patches from for-linus to 3.18 instead, pull in this changes that will go to Linus today.
Diffstat (limited to 'include/linux/hash.h')
-rw-r--r--include/linux/hash.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/hash.h b/include/linux/hash.h
index bd1754c7ecef..d0494c399392 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -37,6 +37,9 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits)
{
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;
@@ -51,6 +54,7 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits)
hash += n;
n <<= 2;
hash += n;
+#endif
/* High bits are more random, so use them. */
return hash >> (64 - bits);