Trait malachite_base::num::arithmetic::traits::CeilingModPowerOf2Assign
source · pub trait CeilingModPowerOf2Assign {
// Required method
fn ceiling_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-positive.
If the quotient were computed, the quotient and remainder would satisfy $x = q2^k + r$ and $0 \leq -r < 2^k$.
Required Methods§
fn ceiling_mod_power_of_2_assign(&mut self, other: u64)
Implementations on Foreign Types§
source§impl CeilingModPowerOf2Assign for i8
impl CeilingModPowerOf2Assign for i8
source§fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-positive.
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 \lceil\frac{x}{2^k} \right \rceil. $$
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is positive or Self::MIN
, and pow
is greater than or equal to
Self::WIDTH
.
§Examples
See here.
source§impl CeilingModPowerOf2Assign for i16
impl CeilingModPowerOf2Assign for i16
source§fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-positive.
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 \lceil\frac{x}{2^k} \right \rceil. $$
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is positive or Self::MIN
, and pow
is greater than or equal to
Self::WIDTH
.
§Examples
See here.
source§impl CeilingModPowerOf2Assign for i32
impl CeilingModPowerOf2Assign for i32
source§fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-positive.
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 \lceil\frac{x}{2^k} \right \rceil. $$
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is positive or Self::MIN
, and pow
is greater than or equal to
Self::WIDTH
.
§Examples
See here.
source§impl CeilingModPowerOf2Assign for i64
impl CeilingModPowerOf2Assign for i64
source§fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-positive.
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 \lceil\frac{x}{2^k} \right \rceil. $$
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is positive or Self::MIN
, and pow
is greater than or equal to
Self::WIDTH
.
§Examples
See here.
source§impl CeilingModPowerOf2Assign for i128
impl CeilingModPowerOf2Assign for i128
source§fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-positive.
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 \lceil\frac{x}{2^k} \right \rceil. $$
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is positive or Self::MIN
, and pow
is greater than or equal to
Self::WIDTH
.
§Examples
See here.
source§impl CeilingModPowerOf2Assign for isize
impl CeilingModPowerOf2Assign for isize
source§fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
fn ceiling_mod_power_of_2_assign(&mut self, pow: u64)
Divides a number by $2^k$, replacing the first number by the remainder. The remainder is non-positive.
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 \lceil\frac{x}{2^k} \right \rceil. $$
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is positive or Self::MIN
, and pow
is greater than or equal to
Self::WIDTH
.
§Examples
See here.