1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:00:08 -07:00

cmd/asm: remove needless check for negative right shift

In the parser, the shift value is always a uint64.

Change-Id: I9b50295a9f7d174ed1f6f9baf78ec0ed43db417f
Reviewed-on: https://go-review.googlesource.com/11322
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Rob Pike 2015-06-21 18:02:44 -07:00
parent 626188dd31
commit 71859efceb

View File

@ -812,10 +812,8 @@ func (p *Parser) term() uint64 {
case lex.RSH:
p.next()
shift := p.term()
if shift < 0 {
p.errorf("negative right shift %d", shift)
}
if shift > 0 && value&(1<<63) != 0 {
// shift is a uint, so can never be negative.
if value&(1<<63) != 0 {
p.errorf("right shift with high bit set")
}
value >>= uint(shift)