This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue 19072 - Object.toHash and typeid(void*).getHash(&ptr) shoul…
…d be more varied in their low bits The low bits of Object.toHash are insufficiently varied. Depending on the platform the bottom 4, 3, or 2 bits of the result will always be zero. This is bad because the low bits of a hash code are typically the most significant for hashtable implementations. D's builtin AA deals with this and other potential defects by rehashing the hash codes it receives. Some 3rd party hashtable implementations do the same, but others assume that keys with a defined toHash have reasonable hashcodes that can be used without need for further mixing. Fixing this is not hard and not computationally expensive. This PR also does a similar thing for raw pointers. Although it will not always be necessary for them the cost is low and it will frequently be a benefit.
- Loading branch information