forked from KolibriOS/kolibrios
ddk: 3.19-rc1
git-svn-id: svn://kolibrios.org@5270 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -36,6 +36,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;
|
||||
@@ -50,6 +53,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);
|
||||
@@ -78,4 +82,5 @@ static inline u32 hash32_ptr(const void *ptr)
|
||||
#endif
|
||||
return (u32)val;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_HASH_H */
|
||||
|
Reference in New Issue
Block a user