From f245799479a862097b10ae0506dd27c48dc7e60a Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 1 Dec 2015 17:48:32 +0300 Subject: [PATCH] Custom hashers for ID manager --- rpcs3/Emu/IdManager.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/IdManager.h b/rpcs3/Emu/IdManager.h index d6bbef9d18..83b35d1308 100644 --- a/rpcs3/Emu/IdManager.h +++ b/rpcs3/Emu/IdManager.h @@ -81,7 +81,16 @@ namespace idm } }; - using map_t = std::unordered_map; + // Custom hasher for ID values (map to itself) + struct id_hash_t final + { + std::size_t operator ()(u32 value) const + { + return value; + } + }; + + using map_t = std::unordered_map; // Can be called from the constructor called through make() or make_ptr() to get the ID of the object being created inline u32 get_last_id() @@ -276,7 +285,16 @@ namespace idm // object are deleted when the emulation is stopped namespace fxm { - using map_t = std::unordered_map>; + // Custom hasher for aligned pointer values + struct hash_t final + { + std::size_t operator()(id_type_index_t value) const + { + return reinterpret_cast(value) >> 3; + } + }; + + using map_t = std::unordered_map, hash_t>; // Remove all objects void clear();