]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: simplify evacuate's handling of NaNs
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 18 Aug 2017 00:41:44 +0000 (17:41 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 18 Aug 2017 18:19:47 +0000 (18:19 +0000)
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>
src/runtime/hashmap.go

index f39fb7d3bf9a32c6b9b66999778aea3bfd4ffa35..cef41be4847acc8bed498ec6ace50e17d00a5a7d 100644 (file)
@@ -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
+                                               }
                                        }
                                }