Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2018-01-02 14:35:08 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2018-01-03 12:00:53 +0300
commita23cc4752708d1adea0dc863570897bb46476fcd (patch)
tree56b4cfa9d5d2bd872fac5ba41e4944b3d468a43a
parentbed659751380457e2dfc06eff38a51dd0ade6c22 (diff)
Issue #1292
Revert broken in c9df77d RA hashing impl.
-rw-r--r--redis_array_impl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/redis_array_impl.c b/redis_array_impl.c
index 0d740a0f..d8219b99 100644
--- a/redis_array_impl.c
+++ b/redis_array_impl.c
@@ -475,6 +475,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;
@@ -485,7 +486,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);