Standard library / math/bits
bits.RotateLeft16()
Rotates bits left by k modulo the word width; negative k rotates right. Expected stdout: '8\n'.
Formal Syntax & Structure
go syntaxgo
func RotateLeft16(x uint16, k int) uint16Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | uint16 | First input operand (or sole input if unary). |
| k | int | Signed rotation distance. |
Return Value
uint16
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.RotateLeft16(1, 3))}