pub trait SaturatingAddMulAssign<Y = Self, Z = Self> {
    fn saturating_add_mul_assign(&mut self, y: Y, z: Z);
}
Expand description

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

Required Methods

Implementations on Foreign Types

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Adds a number and the product of two other numbers in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + yz & \text{if} \quad m \leq x + yz \leq M, \\ M & \text{if} \quad x + yz > M, \\ m & \text{if} \quad x + yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors