mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 13:58:58 -04:00
Improve the hashsocket function.
svn:r989
This commit is contained in:
parent
55bcd7d2f0
commit
91e3ead85e
7
evmap.c
7
evmap.c
@ -91,7 +91,12 @@ struct event_map_entry {
|
|||||||
static inline unsigned
|
static inline unsigned
|
||||||
hashsocket(struct event_map_entry *e)
|
hashsocket(struct event_map_entry *e)
|
||||||
{
|
{
|
||||||
return (unsigned) e->fd;
|
/* On win32, in practice, the low 2-3 bits of a SOCKET seem not to
|
||||||
|
* 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);
|
||||||
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user