]> Cypherpunks repositories - gostls13.git/commit
cmd/vet: allow shifts by amounts calculated using unsafe
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 28 Feb 2017 18:29:58 +0000 (10:29 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 28 Feb 2017 19:13:18 +0000 (19:13 +0000)
commitd99d5f7caa10b679f8509c22aafb35a51ab716ae
tree56b5c82af8de7a849fc45b982d8ded7e09984e8a
parent016569f204ed1c1060778b03ecacb33bc882d69a
cmd/vet: allow shifts by amounts calculated using unsafe

The real world code that inspired this fix,
from runtime/pprof/map.go:

// Compute hash of (stk, tag).
h := uintptr(0)
for _, x := range stk {
h = h<<8 | (h >> (8 * (unsafe.Sizeof(h) - 1)))
h += uintptr(x) * 41
}
h = h<<8 | (h >> (8 * (unsafe.Sizeof(h) - 1)))
h += uintptr(tag) * 41

Change-Id: I99a95b97cba73811faedb0b9a1b9b54e9a1784a3
Reviewed-on: https://go-review.googlesource.com/37574
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/vet/shift.go
src/cmd/vet/testdata/shift.go