pub trait WrappingAbsAssign {
    fn wrapping_abs_assign(&mut self);
}
Expand description

Replaces a number with its absolute value, wrapping around at the boundary of the type.

Required Methods

Implementations on Foreign Types

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors