|
|
@@ -2978,9 +2978,13 @@ inline void get_remote_ip_and_port(socket_t sock, std::string &ip, int &port) {
|
|
|
|
|
|
inline constexpr unsigned int str2tag_core(const char *s, size_t l,
|
|
|
unsigned int h) {
|
|
|
- return (l == 0) ? h
|
|
|
- : str2tag_core(s + 1, l - 1,
|
|
|
- (h * 33) ^ static_cast<unsigned char>(*s));
|
|
|
+ return (l == 0)
|
|
|
+ ? h
|
|
|
+ : str2tag_core(
|
|
|
+ s + 1, l - 1,
|
|
|
+ //unsets the 6 high bits of h, therefore no overflow happens
|
|
|
+ (((std::numeric_limits<unsigned int>::max)() >> 6) & h * 33) ^
|
|
|
+ static_cast<unsigned char>(*s));
|
|
|
}
|
|
|
|
|
|
inline unsigned int str2tag(const std::string &s) {
|