IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

mulwide

def mulwide(a: UInt32, b: UInt32) -> UInt64

Performs a wide multiplication of two 32-bit unsigned integers.

Multiplies two 32-bit unsigned integers and returns the full 64-bit result. Useful when the product may exceed 32 bits.

Note: The product is computed in 64-bit arithmetic, which NVIDIA GPUs compile to a single mul.wide.u32 instruction.

Args:

  • ​a (UInt32): First 32-bit unsigned integer operand.
  • ​b (UInt32): Second 32-bit unsigned integer operand.

Returns:

UInt64: The full 64-bit product of a * b

def mulwide(a: Int32, b: Int32) -> Int64

Performs a wide multiplication of two 32-bit signed integers.

Multiplies two 32-bit signed integers and returns the full 64-bit result. Useful when the product may exceed 32 bits or be negative.

Note: The product is computed in 64-bit arithmetic, which NVIDIA GPUs compile to a single mul.wide.s32 instruction.

Args:

  • ​a (Int32): First 32-bit signed integer operand.
  • ​b (Int32): Second 32-bit signed integer operand.

Returns:

Int64: The full 64-bit signed product of a * b