From ed02d7c9748509926b15a94dea70bf46f5ac8612 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 25 Aug 2022 19:50:01 -0700 Subject: [PATCH] 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 --- common/bitmap_store.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/bitmap_store.cpp b/common/bitmap_store.cpp index cc224d6726..3bca791cac 100644 --- a/common/bitmap_store.cpp +++ b/common/bitmap_store.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -93,7 +94,10 @@ static const wxString IMAGE_ARCHIVE = wxT( "images.tar.gz" ); size_t std::hash>::operator()( const std::pair& aPair ) const { - return std::hash()( static_cast( aPair.first ) ^ std::hash()( aPair.second ) ); + std::size_t seed = 0xa82de1c0; + hash_combine( seed, static_cast( aPair.first ), static_cast( aPair.second ) ); + + return seed; }