mirror of https://github.com/golang/go.git
spec: clarify that signed integers are permitted as shift counts
In Go1.13 and above, signed integers are permitted as shift counts as long as they are non-negative. However, the list in the "Arithmetic operators" section says shift operators accept "unsigned integer" as of right operands. Replacing this to "integer >= 0" would reduce the misunderstanding that shift operators permit only unsigned integers. Go1.13 Release Notes: https://golang.org/doc/go1.13
This commit is contained in:
parent
d9fd38e68b
commit
4f263a48d3
|
|
@ -1,6 +1,6 @@
|
|||
<!--{
|
||||
"Title": "The Go Programming Language Specification",
|
||||
"Subtitle": "Version of Feb 24, 2021",
|
||||
"Subtitle": "Version of Mar 16, 2021",
|
||||
"Path": "/ref/spec"
|
||||
}-->
|
||||
|
||||
|
|
@ -3681,8 +3681,8 @@ The bitwise logical and shift operators apply to integers only.
|
|||
^ bitwise XOR integers
|
||||
&^ bit clear (AND NOT) integers
|
||||
|
||||
<< left shift integer << unsigned integer
|
||||
>> right shift integer >> unsigned integer
|
||||
<< left shift integer << integer >= 0
|
||||
>> right shift integer >> integer >= 0
|
||||
</pre>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue