From: nobishino Date: Tue, 16 Mar 2021 19:49:13 +0000 (+0000) Subject: spec: clarify that signed integers>=0 are permitted as shift counts X-Git-Tag: go1.17beta1~1098 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=13a0f7b50299f9ab40dad7c855539af65e34d132;p=gostls13.git 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: 4f263a48d3b19ca06a277c5fef78df55e9a92b10 GitHub-Pull-Request: golang/go#44664 Reviewed-on: https://go-review.googlesource.com/c/go/+/297249 Reviewed-by: Emmanuel Odeke Reviewed-by: Robert Griesemer Trust: Emmanuel Odeke Trust: Robert Griesemer --- diff --git a/doc/go_spec.html b/doc/go_spec.html index 2a1322fb0f..39617cf524 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -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