Spread bitmap store hash table elements

XOR of two sequential ints makes for an inefficient hash table.  The
hash_combine function is intended for this purpose
This commit is contained in:
Seth Hillbrand 2022-08-25 19:50:01 -07:00
parent ae6a2a6443
commit ed02d7c974
1 changed files with 5 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#include <bitmaps.h>
#include <bitmap_store.h>
#include <bitmaps/bitmap_info.h>
#include <hash_eda.h>
#include <kiplatform/ui.h>
#include <paths.h>
#include <pgm_base.h>
@ -93,7 +94,10 @@ static const wxString IMAGE_ARCHIVE = wxT( "images.tar.gz" );
size_t std::hash<std::pair<BITMAPS, int>>::operator()( const std::pair<BITMAPS, int>& aPair ) const
{
return std::hash<int>()( static_cast<int>( aPair.first ) ^ std::hash<int>()( aPair.second ) );
std::size_t seed = 0xa82de1c0;
hash_combine( seed, static_cast<size_t>( aPair.first ), static_cast<size_t>( aPair.second ) );
return seed;
}