fix hash(::BigInt) on 32 bit systems#50076
Conversation
hash(::BigInt) on 32 bit systems
|
Wow you're fast! |
|
you're assuming that the fix is actually correct :) I am mostly just guessing. |
|
Hmm, yeah. On 32-bit systems the pointer in a BigInt is a UInt32 pointer, so creating a UInt64 pointer and |
|
Yeah. I don't think this is workable. Let's eval it out then. |
|
grr. The collision test fails. Any thoughts? |
|
The The best approach would be to adjust BigInt and BigFloat hashing to reduce collisions, but we shouldn't hold these bugfixes for that. |
|
Was this broken only since 1.9? Do we know what is broken in the current code for 32 bits systems? |
|
The following is merely speculation:
Unlikely
I believe Int64 gets hashed in one go while BigInt gets hashed one UInt32 chunk at a time, so for numbers in the range |
|
The hash range used to fold back on itself for certain types, so it is not a comment about the required guarantee but simply a statement about why it was not zero anymore and why the resulting collisions are still rare enough (and not e.g. clustered) |
|
This has been broken since at least #38031 (it goes further back, but git blame is hard to track then). |
Testing a few old 32 bit arm builds that I have, it worked in v1.4.2 and was broken by v1.5.3. |
* don't define hash(::BigInt) on 32 bit systems (cherry picked from commit c3ea5dc)
* don't define hash(::BigInt) on 32 bit systems (cherry picked from commit c3ea5dc)
* don't define hash(::BigInt) on 32 bit systems (cherry picked from commit c3ea5dc)
Theoretically fixes #50075 (CI will let us know for sure).