Operator and syntax
Go shift operators
Shift counts must be nonnegative integer values; a negative runtime count panics. Signed right shift is arithmetic. Shifts are not rotations and are not capped by the operand width. Example output: '-2 12'.
Formal Syntax & Structure
go syntaxgo
x << n; x >> nWorking Example
Example Snippetgo
package main
import ( "fmt")
func main() { var n int8 = -8 fmt.Println(n>>2, uint8(3)<<2)}