]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/asm: remove needless check for negative right shift
authorRob Pike <r@golang.org>
Mon, 22 Jun 2015 01:02:44 +0000 (18:02 -0700)
committerRob Pike <r@golang.org>
Mon, 22 Jun 2015 06:57:19 +0000 (06:57 +0000)
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>
src/cmd/asm/internal/asm/parse.go

index 7f956cb2a8b02f4a6e72e8b1f6bbc27027eb268b..d7b52509139db246d2acc4ec1cbb9157fd15593d 100644 (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)