Trait malachite_base::num::arithmetic::traits::PowerOf2

source ·
pub trait PowerOf2<POW> {
    // Required method
    fn power_of_2(pow: POW) -> Self;
}
Expand description

Raises 2 to a power.

Required Methods§

source

fn power_of_2(pow: POW) -> Self

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PowerOf2<i64> for f32

source§

fn power_of_2(pow: i64) -> f32

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the power is smaller than Self::MIN_EXPONENT or greater than Self::MAX_EXPONENT.

§Examples

See here.

source§

impl PowerOf2<i64> for f64

source§

fn power_of_2(pow: i64) -> f64

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the power is smaller than Self::MIN_EXPONENT or greater than Self::MAX_EXPONENT.

§Examples

See here.

source§

impl PowerOf2<u64> for i8

source§

fn power_of_2(pow: u64) -> i8

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for i16

source§

fn power_of_2(pow: u64) -> i16

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for i32

source§

fn power_of_2(pow: u64) -> i32

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for i64

source§

fn power_of_2(pow: u64) -> i64

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for i128

source§

fn power_of_2(pow: u64) -> i128

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for isize

source§

fn power_of_2(pow: u64) -> isize

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for u8

source§

fn power_of_2(pow: u64) -> u8

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for u16

source§

fn power_of_2(pow: u64) -> u16

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for u32

source§

fn power_of_2(pow: u64) -> u32

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for u64

source§

fn power_of_2(pow: u64) -> u64

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for u128

source§

fn power_of_2(pow: u64) -> u128

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

source§

impl PowerOf2<u64> for usize

source§

fn power_of_2(pow: u64) -> usize

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Implementors§