diff options
author | Russ Cox <rsc@golang.org> | 2012-02-06 11:24:34 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2012-02-06 11:24:34 -0500 |
commit | facee93a8627881ae39abda13cba115274fe20cf (patch) | |
tree | 53dfa8529c6f2a7be3c29a6aab01f598d593c528 | |
parent | 48bd13911de978effd30402253de523b8eb4bb11 (diff) | |
download | go-facee93a8627881ae39abda13cba115274fe20cf.tar.gz go-facee93a8627881ae39abda13cba115274fe20cf.zip |
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
-rw-r--r-- | src/pkg/runtime/alg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/runtime/alg.c b/src/pkg/runtime/alg.c index eec523aad4..e3c42916e9 100644 --- a/src/pkg/runtime/alg.c +++ b/src/pkg/runtime/alg.c @@ -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; } |