Standard library / math/bits

bits.Reverse()

Reverses bit order across the entire word, not just the significant bits. Native uint width is architecture-dependent; local validation uses 64 bits. Expected stdout: '13\n'.

Formal Syntax & Structure

go syntaxgo
func Reverse(x uint) uint

Parameters & Attributes

NameTypeDescription
xuintFirst input operand (or sole input if unary).

Return Value

uint

Reverses bit order across the entire word, not just the significant bits. Native uint width is architecture-dependent; local validation uses 64 bits.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/bits")
func main() {  fmt.Println(bits.Reverse(bits.Reverse(13)))}
Go Reference