X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=hash.h;h=13600f4e5e4b3602df1e59636e3d687b1ce0dc82;hp=93dd8318ffa11dcb4324ab5ec7622880506916fd;hb=a5a4fdfd44ec1b55ebab7800a931c148540a7324;hpb=ed1860cd8f45677dc592e4fa518dde1cc4c904a5 diff --git a/hash.h b/hash.h index 93dd8318..13600f4e 100644 --- a/hash.h +++ b/hash.h @@ -28,6 +28,8 @@ #error Define GOLDEN_RATIO_PRIME for your wordsize. #endif +#define GR_PRIME_64 0x9e37fffffffc0001UL + static inline unsigned long __hash_long(unsigned long val) { unsigned long hash = val; @@ -60,6 +62,11 @@ static inline unsigned long hash_long(unsigned long val, unsigned int bits) /* High bits are more random, so use them. */ 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) {