Function div

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

Computes the quotient of the first operand divided by the second operand, saturating on overflow. Division by zero is treated as zero. This serves as the definition of the division operation in the dice expression language.

§Parameters

  • op1: The dividend.
  • op2: The divisor.

§Returns

The quotient of the operands.

§Examples

assert_eq!(div(6, 2), 3);
assert_eq!(div(6, 0), 0);
assert_eq!(div(i32::MIN, -1), i32::MAX);