mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: clarify unsigned interpretation of AuxInt
The way Value.AuxInt represents unsigned numbers is currently documented in genericOps.go, which is not the most obvious place for it. Move that documentation to Value.AuxInt. Furthermore, to make it harder to use incorrectly, introduce a Value.AuxUnsigned accessor that returns the zero-extended value of Value.AuxInt. Change-Id: I85030c3c68761404058a430e0b1c7464591b2f42 Reviewed-on: https://go-review.googlesource.com/102597 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
a29e25b82c
commit
2d8181e7b5
3 changed files with 25 additions and 14 deletions
|
|
@ -17,8 +17,6 @@ package main
|
|||
// all args take signed inputs, or don't care whether their inputs
|
||||
// are signed or unsigned.
|
||||
|
||||
// Unused portions of AuxInt are filled by sign-extending the used portion.
|
||||
// Users of AuxInt which interpret AuxInt as unsigned (e.g. shifts) must be careful.
|
||||
var genericOps = []opData{
|
||||
// 2-input arithmetic
|
||||
// Types must be consistent with Go typing. Add, for example, must take two values
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue