mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: fix float64 hash on 32-bit machine
Multiplying by the low 32 bits was a bad idea no matter what, but it was a particularly unfortunate choice because those bits are 0 for small integer values. Fixes #2883. R=ken2 CC=golang-dev https://golang.org/cl/5634047
This commit is contained in:
parent
48bd13911d
commit
facee93a86
1 changed files with 1 additions and 1 deletions
|
|
@ -271,7 +271,7 @@ runtime·f64hash(uintptr *h, uintptr s, void *a)
|
|||
else {
|
||||
u = *(uint64*)a;
|
||||
if(sizeof(uintptr) == 4)
|
||||
hash = ((uint32)(u>>32) ^ 2860486313) * (uint32)u;
|
||||
hash = ((uint32)(u>>32) * 3267000013UL) ^ (uint32)u;
|
||||
else
|
||||
hash = u;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue