Improve hashsocket() (for win32) to avoid collisions

Fixes: 91e3ead
Refs: https://gist.github.com/azat/8a0a94e4de2d95af8f729b709589ce12
This commit is contained in:
Cœur 2024-05-05 02:03:35 +08:00 committed by Azat Khuzhin
parent b456e4bd82
commit ba0442bacc

View File

@ -95,7 +95,7 @@ hashsocket(struct event_map_entry *e)
* matter. Our hashtable implementation really likes low-order bits,
* though, so let's do the rotate-and-add trick. */
unsigned h = (unsigned) e->fd;
h += (h >> 2) | (h << 30);
h = (h >> 2) | (h << 30);
return h;
}