mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 20:41:27 -04:00
Try to fix a warning in hash_debug_entry
Apparently some 64-bit platforms don't like it when you say unsigned hash(void *p) { return (unsigned)p; } even if you really honestly don't want the high bits of p. Perhaps they will tolerate it if I say the equivalent of unsigned hash(void *p) { return (unsigned) (uintptr_t) p; }
This commit is contained in:
parent
cef61a2f1b
commit
137f2c602f
9
event.c
9
event.c
@ -157,10 +157,15 @@ struct event_debug_entry {
|
|||||||
static inline unsigned
|
static inline unsigned
|
||||||
hash_debug_entry(const struct event_debug_entry *e)
|
hash_debug_entry(const struct event_debug_entry *e)
|
||||||
{
|
{
|
||||||
|
/* We need to do this silliness to convince compilers that we
|
||||||
|
* honestly mean to cast e->ptr to an integer, and discard any
|
||||||
|
* part of it that doesn't fit in an unsigned.
|
||||||
|
*/
|
||||||
|
unsigned u = (unsigned) ((ev_uintptr_t) e->ptr);
|
||||||
/* Our hashtable implementation is pretty sensitive to low bits,
|
/* Our hashtable implementation is pretty sensitive to low bits,
|
||||||
* and every struct event is over 64 bytes in size, so we can
|
* and every struct event is over 64 bytes in size, so we can
|
||||||
* just say... */
|
* just say >>6. */
|
||||||
return ((unsigned)e->ptr) >> 6;
|
return (u >> 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user