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) Value

Parameters & Attributes

NameTypeDescription
xValueInput constant or Go value as specified by the function.
optoken.TokenOperator token appropriate for this operation.
suintShift 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)) }
Go Reference