Skip to main content

Mojo function

mulwide

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: On NVIDIA GPUs, this maps directly to the MUL.WIDE.U32 PTX instruction. On others, it performs multiplication using 64-bit casts.

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

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: On NVIDIA GPUs, this maps directly to the MUL.WIDE.S32 PTX instruction. On others, it performs multiplication using 64-bit casts.

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

Was this page helpful?