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
This commit is contained in:
parent
10c1072479
commit
e4756c811e
|
@ -93,7 +93,9 @@ namespace std
|
|||
{
|
||||
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