mirror of https://github.com/PCSX2/pcsx2.git
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.
This commit is contained in:
parent
a6d8b3b847
commit
d132e6bce4
|
@ -343,14 +343,17 @@ public:
|
||||||
/// This method has been optimized to give typical 32 bit pointers a reasonably
|
/// This method has been optimized to give typical 32 bit pointers a reasonably
|
||||||
/// wide spread across the integer spectrum.
|
/// wide spread across the integer spectrum.
|
||||||
/// Note:
|
/// Note:
|
||||||
/// This method is optimized for 32 bit pointers only. 64 bit pointer support
|
/// This method is optimized for 32 bit pointers only.
|
||||||
/// has not been implemented, and thus on 64 bit platforms performance could be poor or,
|
/// 64 bit pointer support is implemented but not optimized.
|
||||||
/// worse yet, results may not have a high degree of uniqueness.
|
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
hash_key_t operator()( const void* addr ) const
|
hash_key_t operator()( const void* addr ) const
|
||||||
{
|
{
|
||||||
|
#ifdef _ARCH_64
|
||||||
|
return GetCommonHash((u64)addr);
|
||||||
|
#else
|
||||||
hash_key_t key = (hash_key_t) addr;
|
hash_key_t key = (hash_key_t) addr;
|
||||||
return (hash_key_t)((key >> 3) * 2654435761ul);
|
return (hash_key_t)((key >> 3) * 2654435761ul);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue