Skip to main content

DivAssignModPrecomputed

Trait DivAssignModPrecomputed 

Source
pub trait DivAssignModPrecomputed<RHS = Self>: DivModPrecomputed<RHS> {
    // Required method
    fn div_assign_mod_precomputed(
        &mut self,
        other: RHS,
        data: &Self::Data,
    ) -> Self::ModOutput;
}
Expand description

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the divisor (second input).

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

If multiple divisions by the same divisor are necessary, it can be quicker to precompute some piece of data based on the divisor and reuse it in the division calls. This trait provides a function for using precomputed data during division. For precomputing the data, use the precompute_div_mod_data function in DivModPrecomputed.

Required Methods§

Source

fn div_assign_mod_precomputed( &mut self, other: RHS, data: &Self::Data, ) -> Self::ModOutput

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DivAssignModPrecomputed for i8

Source§

fn div_assign_mod_precomputed(&mut self, other: i8, data: &Self::Data) -> i8

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for i16

Source§

fn div_assign_mod_precomputed(&mut self, other: i16, data: &Self::Data) -> i16

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for i32

Source§

fn div_assign_mod_precomputed(&mut self, other: i32, data: &Self::Data) -> i32

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for i64

Source§

fn div_assign_mod_precomputed(&mut self, other: i64, data: &Self::Data) -> i64

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for i128

Source§

fn div_assign_mod_precomputed(&mut self, other: i128, data: &Self::Data) -> i128

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for isize

Source§

fn div_assign_mod_precomputed( &mut self, other: isize, data: &Self::Data, ) -> isize

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for u8

Source§

fn div_assign_mod_precomputed(&mut self, other: u8, data: &Self::Data) -> u8

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for u16

Source§

fn div_assign_mod_precomputed(&mut self, other: u16, data: &Self::Data) -> u16

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for u32

Source§

fn div_assign_mod_precomputed(&mut self, other: u32, data: &Self::Data) -> u32

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for u64

Source§

fn div_assign_mod_precomputed(&mut self, other: u64, data: &Self::Data) -> u64

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for u128

Source§

fn div_assign_mod_precomputed(&mut self, other: u128, data: &Self::Data) -> u128

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivAssignModPrecomputed for usize

Source§

fn div_assign_mod_precomputed( &mut self, other: usize, data: &Self::Data, ) -> usize

Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.

The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.

Some precomputed data is provided; this speeds up computations involving several divisions by the same divisor. The precomputed data should be obtained using precompute_div_mod_data.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§