Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@maruaudio/dsp/math/integer provides multiplyInt32(a, b), the signed low 32 bits of an integer product, equal to Math.imul(a, b). Maru compiler's Processor subset does not admit Math.imul, so the DSP node splits each operand into 16-bit halves; every partial product stays exactly representable in a double, and the result is folded back to a signed word with | 0.

import { multiplyInt32 } from "@maruaudio/dsp/math/integer"

multiplyInt32(0x9e3779b9, 0x85ebca6b) === Math.imul(0x9e3779b9, 0x85ebca6b) // true

Functions

NameInputsOutputDomain as coded
multiplyInt32a, bsigned 32-bit integerOperands are read as 32-bit words (>>> 16, & 0xffff), so signed and unsigned words give the same result

Lifecycle

None. A stateless function with no preparation or instance state.

When to use it

Integer hashing, linear congruential generators and other word arithmetic in code that must compile through Maru compiler as well as run in JavaScript. It is the multiply behind @maru/math-hash.

Limits

  • Only the low 32 bits are returned; the high word of the product is discarded, as with Math.imul.
  • Fractional or non-finite operands are converted by the bitwise operators (truncation, NaN to 0), not rejected.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

None: this node imports no other node.

Dependents

Used by