Skip to content

Commit 13a0f7b

Browse files
nobishinoodeke-em
authored andcommitted
spec: clarify that signed integers>=0 are permitted as shift counts
In Go1.13 and above, signed integers are permitted as shift counts as long as they are >=0. However, the comments in the "Arithmetic operators" section says shift operators accept "unsigned integer" as of right operands. Replacing this with "integer>=0" resolves the misunderstanding that shift operators permit only unsigned integers. Reference: Go1.13 Release Notes: https://golang.org/doc/go1.13 Change-Id: Icd3c7734d539ab702590e992a618c9251c653c37 GitHub-Last-Rev: 4f263a4 GitHub-Pull-Request: #44664 Reviewed-on: https://go-review.googlesource.com/c/go/+/297249 Reviewed-by: Emmanuel Odeke <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Trust: Emmanuel Odeke <[email protected]> Trust: Robert Griesemer <[email protected]>
1 parent d206ca5 commit 13a0f7b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/go_spec.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Version of Feb 24, 2021",
3+
"Subtitle": "Version of Mar 16, 2021",
44
"Path": "/ref/spec"
55
}-->
66

@@ -3681,8 +3681,8 @@ <h3 id="Arithmetic_operators">Arithmetic operators</h3>
36813681
^ bitwise XOR integers
36823682
&amp;^ bit clear (AND NOT) integers
36833683

3684-
&lt;&lt; left shift integer &lt;&lt; unsigned integer
3685-
&gt;&gt; right shift integer &gt;&gt; unsigned integer
3684+
&lt;&lt; left shift integer &lt;&lt; integer >= 0
3685+
&gt;&gt; right shift integer &gt;&gt; integer >= 0
36863686
</pre>
36873687

36883688

0 commit comments

Comments
 (0)