diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-08-17 17:41:44 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-08-18 18:19:47 +0000 |
| commit | 8a9d4184e6e175194e262bde5fe321838b5d40c4 (patch) | |
| tree | 22111c2adcf9de9248425985c8a0519bd0082f0a /src/runtime/hashmap.go | |
| parent | 1ba4556a2c84f552f7c9697ad7323fd6cdbc6970 (diff) | |
| download | go-8a9d4184e6e175194e262bde5fe321838b5d40c4.tar.xz | |
runtime: simplify evacuate's handling of NaNs
The new code is not quite equivalent to the old,
in that if newbit was very large it might have altered the new tophash.
The old behavior is unnecessary and probably undesirable.
Change-Id: I7fb3222520cb61081a857adcddfbb9078ead7122
Reviewed-on: https://go-review.googlesource.com/56930
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/hashmap.go')
| -rw-r--r-- | src/runtime/hashmap.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go index f39fb7d3bf..cef41be484 100644 --- a/src/runtime/hashmap.go +++ b/src/runtime/hashmap.go @@ -1086,15 +1086,12 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) { // We recompute a new random tophash for the next level so // these keys will get evenly distributed across all buckets // after multiple grows. - if top&1 != 0 { - hash |= newbit - } else { - hash &^= newbit - } + useY = top & 1 top = tophash(hash) - } - if hash&newbit != 0 { - useY = 1 + } else { + if hash&newbit != 0 { + useY = 1 + } } } |
