lkml.org 
[lkml]   [2012]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] core-kernel: use multiply instead of shifts in hash_64
On 03.07.2012 00:25, Andrew Hunter wrote:
> diff --git a/include/linux/hash.h b/include/linux/hash.h
> index b80506b..daabc3d 100644
> --- a/include/linux/hash.h
> +++ b/include/linux/hash.h
> @@ -34,7 +34,9 @@
> static inline u64 hash_64(u64 val, unsigned int bits)
> {
> u64 hash = val;
> -
> +#if BITS_PER_LONG == 64
> + hash *= GOLDEN_RATIO_PRIME_64;
> +#else
> /* Sigh, gcc can't optimise this alone like it does for 32 bits. */

Hmm. Does this comment make sense here now?

Thanks,

/mjt


\
 
 \ /
  Last update: 2012-07-10 16:21    [W:0.131 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site