pub trait RoundToMultipleOfPowerOf2Assign<RHS> {
    // Required method
    fn round_to_multiple_of_power_of_2_assign(
        &mut self,
        pow: RHS,
        rm: RoundingMode,
    ) -> Ordering;
}
Expand description

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

Required Methods§

Implementations on Foreign Types§

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for i8

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for i16

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for i32

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for i64

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for i128

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for isize

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for u8

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for u16

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for u32

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for u64

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for u128

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

source§

impl RoundToMultipleOfPowerOf2Assign<u64> for usize

source§

fn round_to_multiple_of_power_of_2_assign( &mut self, pow: u64, rm: RoundingMode, ) -> Ordering

Rounds a number to a multiple of $2^k$ in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultipleOfPowerOf2 documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_of_power_of_2_assign(pow, Exact);
  • assert!(x.divisible_by_power_of_2(pow));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of the power of 2.
  • If rm is Floor, but self is negative with a too-large absolute value to round to the next lowest multiple.
  • If rm is Ceiling, but self is too large to round to the next highest multiple.
  • If rm is Up, but self has too large an absolute value to round to the next multiple with a greater absolute value.
  • If rm is Nearest, but the nearest multiple is outside the representable range.
§Examples

See here.

Implementors§