Utilize hash_combine to avoid hash collision
Most of our pointers will share the top 32 or more bits of their pointer
addresses, making cache collisions highly likely. This uses a hash
combiner to mix the bits more effectively
(cherry picked from commit e4756c811e
)
This commit is contained in:
parent
ae11213622
commit
6c7261a223
|
@ -93,7 +93,9 @@ namespace std
|
||||||
{
|
{
|
||||||
std::size_t operator()( const CLEARANCE_CACHE_KEY& k ) const
|
std::size_t operator()( const CLEARANCE_CACHE_KEY& k ) const
|
||||||
{
|
{
|
||||||
return hash<const void*>()( k.A ) ^ hash<const void*>()( k.B ) ^ hash<int>()( k.Flag );
|
size_t retval = 0xBADC0FFEE0DDF00D;
|
||||||
|
hash_combine( retval, hash<const void*>()( k.A ), hash<const void*>()( k.B ), hash<int>()( k.Flag ) );
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue