pub trait SaturatingAddMulAssign<Y = Self, Z = Self> {
    // Required method
    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§

source

fn saturating_add_mul_assign(&mut self, y: Y, z: Z)

Implementations on Foreign Types§

source§

impl SaturatingAddMulAssign for i8

source§

fn saturating_add_mul_assign(&mut self, y: i8, z: i8)

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.

source§

impl SaturatingAddMulAssign for i16

source§

fn saturating_add_mul_assign(&mut self, y: i16, z: i16)

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.

source§

impl SaturatingAddMulAssign for i32

source§

fn saturating_add_mul_assign(&mut self, y: i32, z: i32)

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.

source§

impl SaturatingAddMulAssign for i64

source§

fn saturating_add_mul_assign(&mut self, y: i64, z: i64)

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.

source§

impl SaturatingAddMulAssign for i128

source§

fn saturating_add_mul_assign(&mut self, y: i128, z: i128)

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.

source§

impl SaturatingAddMulAssign for isize

source§

fn saturating_add_mul_assign(&mut self, y: isize, z: isize)

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.

source§

impl SaturatingAddMulAssign for u8

source§

fn saturating_add_mul_assign(&mut self, y: u8, z: u8)

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.

source§

impl SaturatingAddMulAssign for u16

source§

fn saturating_add_mul_assign(&mut self, y: u16, z: u16)

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.

source§

impl SaturatingAddMulAssign for u32

source§

fn saturating_add_mul_assign(&mut self, y: u32, z: u32)

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.

source§

impl SaturatingAddMulAssign for u64

source§

fn saturating_add_mul_assign(&mut self, y: u64, z: u64)

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.

source§

impl SaturatingAddMulAssign for u128

source§

fn saturating_add_mul_assign(&mut self, y: u128, z: u128)

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.

source§

impl SaturatingAddMulAssign for usize

source§

fn saturating_add_mul_assign(&mut self, y: usize, z: usize)

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§