From 05b189bc261318d5e563ff35cb46b330114865cf Mon Sep 17 00:00:00 2001 From: Mat M Date: Sat, 3 Sep 2016 07:48:47 -0400 Subject: [PATCH] arm_types: Specialize std::hash for LocationDescriptor (#14) Same thing, but with the benefit of working with anything that uses std::hash by default. --- src/backend_x64/emit_x64.h | 6 +++--- src/frontend/arm_types.h | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/backend_x64/emit_x64.h b/src/backend_x64/emit_x64.h index 839feed1..6ef86439 100644 --- a/src/backend_x64/emit_x64.h +++ b/src/backend_x64/emit_x64.h @@ -81,9 +81,9 @@ private: Jit* jit_interface; std::unordered_map unique_hash_to_code_ptr; std::unordered_map> patch_unique_hash_locations; - std::unordered_map basic_blocks; - std::unordered_map, Arm::LocationDescriptorHash> patch_jg_locations; - std::unordered_map, Arm::LocationDescriptorHash> patch_jmp_locations; + std::unordered_map basic_blocks; + std::unordered_map> patch_jg_locations; + std::unordered_map> patch_jmp_locations; }; } // namespace BackendX64 diff --git a/src/frontend/arm_types.h b/src/frontend/arm_types.h index 054de093..36434a1a 100644 --- a/src/frontend/arm_types.h +++ b/src/frontend/arm_types.h @@ -137,12 +137,6 @@ private: Arm::FPSCR fpscr; ///< Floating point status control register. }; -struct LocationDescriptorHash { - size_t operator()(const LocationDescriptor& x) const { - return std::hash()(x.UniqueHash()); - } -}; - const char* CondToString(Cond cond, bool explicit_al = false); const char* RegToString(Reg reg); const char* ExtRegToString(ExtReg reg); @@ -183,3 +177,12 @@ inline ExtReg operator+(ExtReg reg, size_t number) { } // namespace Arm } // namespace Dynarmic + +namespace std { +template <> +struct hash { + size_t operator()(const Dynarmic::Arm::LocationDescriptor& x) const { + return std::hash()(x.UniqueHash()); + } +}; +} // namespace std