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-02 14:35:08 +0300
commit837dee471ccac86581d306594ee945e82027572f (patch)
treeada2a771c50b61830ad37475db4e11e6bbd4a948 /redis_array_impl.c
parentb566fb44efec4450d3ae53802ddd6ea17c70f27b (diff)
Issue #1292
Revert broken in c9df77d RA hashing impl.
Diffstat (limited to 'redis_array_impl.c')
-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 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);