nghttpx: Explicitly cast to uint32_t for hash calculation
This commit is contained in:
parent
ca39c71ac3
commit
30f26a2b9d
|
@ -687,7 +687,9 @@ uint32_t compute_affinity_from_ip(const StringRef &ip) {
|
|||
return util::hash32(ip);
|
||||
}
|
||||
|
||||
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
|
||||
return (static_cast<uint32_t>(buf[0]) << 24) |
|
||||
(static_cast<uint32_t>(buf[1]) << 16) |
|
||||
(static_cast<uint32_t>(buf[2]) << 8) | static_cast<uint32_t>(buf[3]);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -2854,8 +2854,10 @@ int compute_affinity_hash(std::vector<AffinityHash> &res, size_t idx,
|
|||
}
|
||||
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
auto h = (buf[4 * i] << 24) | (buf[4 * i + 1] << 16) |
|
||||
(buf[4 * i + 2] << 8) | buf[4 * i + 3];
|
||||
auto h = (static_cast<uint32_t>(buf[4 * i]) << 24) |
|
||||
(static_cast<uint32_t>(buf[4 * i + 1]) << 16) |
|
||||
(static_cast<uint32_t>(buf[4 * i + 2]) << 8) |
|
||||
static_cast<uint32_t>(buf[4 * i + 3]);
|
||||
|
||||
res.emplace_back(idx, h);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue