pub trait ModPowerOf2Assign {
    fn mod_power_of_2_assign(&mut self, other: u64);
}
Expand description

Divides a number by $2^k$, replacing the number by the remainder. The remainder is non-negative.

If the quotient were computed, the quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

Required Methods

Implementations on Foreign Types

Divides a number by $2^k$, replacing the first number by the remainder.

If the quotient were computed, the quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder.

If the quotient were computed, the quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder.

If the quotient were computed, the quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder.

If the quotient were computed, the quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder.

If the quotient were computed, the quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder.

If the quotient were computed, the quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-negative.

If the quotient were computed, he quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is negative and pow is greater than or equal to Self::WIDTH.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-negative.

If the quotient were computed, he quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is negative and pow is greater than or equal to Self::WIDTH.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-negative.

If the quotient were computed, he quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is negative and pow is greater than or equal to Self::WIDTH.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-negative.

If the quotient were computed, he quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is negative and pow is greater than or equal to Self::WIDTH.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-negative.

If the quotient were computed, he quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is negative and pow is greater than or equal to Self::WIDTH.

Examples

See here.

Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-negative.

If the quotient were computed, he quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq r < 2^k$.

$$ x \gets x - 2^k\left \lfloor \frac{x}{2^k} \right \rfloor. $$

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is negative and pow is greater than or equal to Self::WIDTH.

Examples

See here.

Implementors