Skip to content
Snippets Groups Projects
Commit 5efdf3ca authored by Craig Tiller's avatar Craig Tiller
Browse files

Fix casting error

parent 3153e5af
No related branches found
No related tags found
No related merge requests found
...@@ -440,7 +440,12 @@ static uint32_t elems_phash(uint32_t i) { ...@@ -440,7 +440,12 @@ static uint32_t elems_phash(uint32_t i) {
i -= 42; i -= 42;
uint32_t x = i % 96; uint32_t x = i % 96;
uint32_t y = i / 96; uint32_t y = i / 96;
return y < GPR_ARRAY_SIZE(elems_r) ? x + (uint32_t)elems_r[y] : 0; uint32_t h = x;
if (y < GPR_ARRAY_SIZE(elems_r)) {
uint32_t delta = (uint32_t)elems_r[y];
h += delta;
}
return h;
} }
static const uint16_t elem_keys[] = { static const uint16_t elem_keys[] = {
......
...@@ -424,7 +424,12 @@ static uint32_t %(name)s_phash(uint32_t i) { ...@@ -424,7 +424,12 @@ static uint32_t %(name)s_phash(uint32_t i) {
i %(offset_sign)s= %(offset)d; i %(offset_sign)s= %(offset)d;
uint32_t x = i %% %(t)d; uint32_t x = i %% %(t)d;
uint32_t y = i / %(t)d; uint32_t y = i / %(t)d;
return y < GPR_ARRAY_SIZE(%(name)s_r) ? x + (uint32_t)%(name)s_r[y] : 0; uint32_t h = x;
if (y < GPR_ARRAY_SIZE(%(name)s_r)) {
uint32_t delta = (uint32_t)%(name)s_r[y];
h += delta;
}
return h;
} }
""" % { """ % {
'name': name, 'name': name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment