Standard library / go/constant
go/constant.Shift()
Shift an integer constant left or right by an unsigned bit count. Unknown propagates. Expected stdout: '1208925819614629174706176\n'.
Formal Syntax & Structure
go syntaxgo
func Shift(x Value, op token.Token, s uint) ValueParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | Value | Input constant or Go value as specified by the function. |
| op | token.Token | Operator token appropriate for this operation. |
| s | uint | Shift distance in bits or string content, depending on the function. |
Return Value
Value
Shift an integer constant left or right by an unsigned bit count.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/constant" "go/token")
func main() { fmt.Println(constant.Shift(constant.MakeInt64(1), token.SHL, 80)) }