Function mul

Source
pub fn mul(op1: i32, op2: i32) -> i32
Expand description

Computes the product of the two operands, saturating on overflow. This serves as the definition of the multiplication operation in the dice expression language.

§Parameters

  • op1: The multiplicand.
  • op2: The multiplier.

§Returns

The product of the operands.

§Examples

assert_eq!(mul(2, 3), 6);
assert_eq!(mul(i32::MAX, 2), i32::MAX);
assert_eq!(mul(i32::MIN, 2), i32::MIN);
assert_eq!(mul(i32::MAX, -1), i32::MIN + 1);