Standard library / math/bits

bits.Mul()

Multiplies two unsigned words, returning high and low halves of the full-width product. Native uint width is architecture-dependent; local validation uses 64 bits. Expected stdout: '0 42\n'.

Formal Syntax & Structure

go syntaxgo
func Mul(x, y uint) (hi, lo uint)

Parameters & Attributes

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

Return Value

(hi, lo uint)

Multiplies two unsigned words, returning high and low halves of the full-width product. Native uint width is architecture-dependent; local validation uses 64 bits.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/bits")
func main() {  h, l := bits.Mul(6, 7)  fmt.Println(h, l)}
Go Reference