Browse Source

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
newinvert
Seth Hillbrand 2 years ago
parent
commit
e4756c811e
  1. 4
      pcbnew/router/pns_kicad_iface.cpp

4
pcbnew/router/pns_kicad_iface.cpp

@ -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…
Cancel
Save