From d132e6bce4598827286b2a3c3643907a943356a6 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 11 Jul 2014 17:16:58 -0500 Subject: [PATCH] Support 64bit address hashing in the CommonHashClass. The class already supports hashing 64bit values, just break it out to support it in this particular case. From the 64bit version of the hash, this hash favours values that aren't on the extreme end. Consdering that hashing is only really used by the class itself it isn't too big of an issue. --- common/include/Utilities/HashMap.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/include/Utilities/HashMap.h b/common/include/Utilities/HashMap.h index 6d2a0ca326..a31329124e 100644 --- a/common/include/Utilities/HashMap.h +++ b/common/include/Utilities/HashMap.h @@ -343,14 +343,17 @@ public: /// This method has been optimized to give typical 32 bit pointers a reasonably /// wide spread across the integer spectrum. /// Note: - /// This method is optimized for 32 bit pointers only. 64 bit pointer support - /// has not been implemented, and thus on 64 bit platforms performance could be poor or, - /// worse yet, results may not have a high degree of uniqueness. + /// This method is optimized for 32 bit pointers only. + /// 64 bit pointer support is implemented but not optimized. /// hash_key_t operator()( const void* addr ) const { +#ifdef _ARCH_64 + return GetCommonHash((u64)addr); +#else hash_key_t key = (hash_key_t) addr; return (hash_key_t)((key >> 3) * 2654435761ul); +#endif }