From 837dee471ccac86581d306594ee945e82027572f Mon Sep 17 00:00:00 2001 From: Pavlo Yatsukhnenko Date: Tue, 2 Jan 2018 13:35:08 +0200 Subject: Issue #1292 Revert broken in c9df77d RA hashing impl. --- redis_array_impl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'redis_array_impl.c') diff --git a/redis_array_impl.c b/redis_array_impl.c index 1a5aa7ba..fbaa6bbd 100644 --- a/redis_array_impl.c +++ b/redis_array_impl.c @@ -471,6 +471,7 @@ ra_find_node(RedisArray *ra, const char *key, int key_len, int *out_pos TSRMLS_D return NULL; } } else { + uint64_t h64; unsigned long ret = 0xffffffff; size_t i; @@ -481,7 +482,10 @@ ra_find_node(RedisArray *ra, const char *key, int key_len, int *out_pos TSRMLS_D hash = (ret ^ 0xffffffff); /* get position on ring */ - pos = (int)(hash * ra->count / 0xffffffff); + h64 = hash; + h64 *= ra->count; + h64 /= 0xffffffff; + pos = (int)h64; } efree(out); -- cgit v1.2.3