Skip to content
Permalink
Browse files

spec: clarify that shift count must be non-negative

Fixes #34056.

Change-Id: I2c9b7a20d19f458df5dcc376e29bee6be1f09f7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/193277
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information...
griesemer committed Sep 4, 2019
1 parent 7b294cd commit 6fcc2d85be557c6890a1ad50ee280fa3cd8088e6
Showing with 2 additions and 2 deletions.
  1. +2 −2 doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of Aug 26, 2019",
"Subtitle": "Version of Sep 4, 2019",
"Path": "/ref/spec"
}-->

@@ -3732,7 +3732,7 @@ <h4 id="Integer_operators">Integer operators</h4>

<p>
The shift operators shift the left operand by the shift count specified by the
right operand, which must be positive. If the shift count is negative at run time,
right operand, which must be non-negative. If the shift count is negative at run time,
a <a href="#Run_time_panics">run-time panic</a> occurs.
The shift operators implement arithmetic shifts if the left operand is a signed
integer and logical shifts if it is an unsigned integer.

0 comments on commit 6fcc2d8

Please sign in to comment.
You can’t perform that action at this time.