Standard library / math/bits
bits.TrailingZeros()
Counts zero bits below the least significant set bit; zero returns the word width. Native uint width is architecture-dependent; local validation uses 64 bits. Expected stdout: '3\n'.
Formal Syntax & Structure
go syntaxgo
func TrailingZeros(x uint) intParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | uint | First input operand (or sole input if unary). |
Return Value
int
Counts zero bits below the least significant set bit; zero returns the word width. 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.TrailingZeros(40))}