You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On 32-bit platforms HashMap only looks at the lowest 32 bits of the hash value. AHash could take advantage of this and only use 32-bit multiplications instead of 64-bit multiplications on such platforms.
The text was updated successfully, but these errors were encountered:
It's kindof odd to have a mode where the upper half of the bits of the hash are all zeros. Given that it is not something that is guaranteed in the documentation of the classes, perhaps a way to do it would be to have 2 32bit hashes in the output. It would allow for 32bit multiplication and only sacrifice the quality in as much as they don't relate to one another. Then if it really isn't being used by the hashmap the compiler can simply optimize one of them out. This is safer in the sense that if some code path actually uses those bits, they aren't just zeros.
On 32-bit platforms a 64-bit value is split into 2 registers anyways, so you could calculate 2 32-bit hashes separately and then combine them in the last step. The compiler can then eliminate one of the calculations if only the low 32 bits of the hash are used.
On 32-bit platforms
HashMap
only looks at the lowest 32 bits of the hash value. AHash could take advantage of this and only use 32-bit multiplications instead of 64-bit multiplications on such platforms.The text was updated successfully, but these errors were encountered: