projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix typo (READ/DDIR_READ).
[fio.git]
/
hash.h
diff --git
a/hash.h
b/hash.h
index 0c3cdda77be642842337f6fe949da7c24581e661..13600f4e5e4b3602df1e59636e3d687b1ce0dc82 100644
(file)
--- a/
hash.h
+++ b/
hash.h
@@
-28,7
+28,9
@@
#error Define GOLDEN_RATIO_PRIME for your wordsize.
#endif
#error Define GOLDEN_RATIO_PRIME for your wordsize.
#endif
-static inline unsigned long hash_long(unsigned long val, unsigned int bits)
+#define GR_PRIME_64 0x9e37fffffffc0001UL
+
+static inline unsigned long __hash_long(unsigned long val)
{
unsigned long hash = val;
{
unsigned long hash = val;
@@
-52,13
+54,23
@@
static inline unsigned long hash_long(unsigned long val, unsigned int bits)
hash *= GOLDEN_RATIO_PRIME;
#endif
hash *= GOLDEN_RATIO_PRIME;
#endif
+ return hash;
+}
+
+static inline unsigned long hash_long(unsigned long val, unsigned int bits)
+{
/* High bits are more random, so use them. */
/* High bits are more random, so use them. */
- return hash >> (BITS_PER_LONG - bits);
+ return __hash_long(val) >> (BITS_PER_LONG - bits);
+}
+
+static inline uint64_t __hash_u64(uint64_t val)
+{
+ return val * GR_PRIME_64;
}
static inline unsigned long hash_ptr(void *ptr, unsigned int bits)
{
}
static inline unsigned long hash_ptr(void *ptr, unsigned int bits)
{
- return hash_long((u
nsigned long
)ptr, bits);
+ return hash_long((u
intptr_t
)ptr, bits);
}
/*
}
/*