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:
Seth Hillbrand 2024-03-29 15:11:23 -07:00
parent ae11213622
commit 6c7261a223
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}
};
}