Standard library / math/bits

bits.RotateLeft8()

Rotates bits left by k modulo the word width; negative k rotates right. Expected stdout: '8\n'.

Formal Syntax & Structure

go syntaxgo
func RotateLeft8(x uint8, k int) uint8

Parameters & Attributes

NameTypeDescription
xuint8First input operand (or sole input if unary).
kintSigned rotation distance.

Return Value

uint8

Rotates bits left by k modulo the word width; negative k rotates right.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/bits")
func main() {  fmt.Println(bits.RotateLeft8(1, 3))}
Go Reference