Standard library / math/bits

bits.TrailingZeros16()

Counts zero bits below the least significant set bit; zero returns the word width. Expected stdout: '3\n'.

Formal Syntax & Structure

go syntaxgo
func TrailingZeros16(x uint16) int

Parameters & Attributes

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

Return Value

int

Counts zero bits below the least significant set bit; zero returns the word width.

Working Example

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