From: Michael Munday Date: Sun, 31 Mar 2019 14:23:07 +0000 (+0100) Subject: runtime: always mask shift amount regardless of architecture X-Git-Tag: go1.13beta1~839 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7b62e984d941c753e7fb20f8b59a49acf62c88a7;p=gostls13.git runtime: always mask shift amount regardless of architecture Currently the shift amount is only masked on x86. Change it so it is masked on all architectures. In the worst case we generate a couple of extra instructions to perform the masking and in the best case we can elide overflow checks. This particular shift could also be replaced with a rotate instruction during optimization which would remove both the masking instructions and overflow checks on all architectures. Fixes #31165. Change-Id: I16b7a8800b4ba8813dc83735dfc59564e661d3b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/170122 Run-TryBot: Michael Munday TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/runtime/map.go b/src/runtime/map.go index 1282a12193..d2ff19336f 100644 --- a/src/runtime/map.go +++ b/src/runtime/map.go @@ -181,10 +181,8 @@ type hiter struct { // bucketShift returns 1<