Trait malachite_base::num::arithmetic::traits::PowerOf2
source · [−]pub trait PowerOf2<POW> {
fn power_of_2(pow: POW) -> Self;
}
Expand description
Raises 2 to a power.
Required Methods
fn power_of_2(pow: POW) -> Self
Implementations on Foreign Types
sourceimpl PowerOf2<u64> for u8
impl PowerOf2<u64> for u8
sourcefn power_of_2(pow: u64) -> u8
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.
sourceimpl PowerOf2<u64> for u16
impl PowerOf2<u64> for u16
sourcefn power_of_2(pow: u64) -> u16
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.
sourceimpl PowerOf2<u64> for u32
impl PowerOf2<u64> for u32
sourcefn power_of_2(pow: u64) -> u32
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.
sourceimpl PowerOf2<u64> for u64
impl PowerOf2<u64> for u64
sourcefn power_of_2(pow: u64) -> u64
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.
sourceimpl PowerOf2<u64> for u128
impl PowerOf2<u64> for u128
sourcefn power_of_2(pow: u64) -> u128
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.
sourceimpl PowerOf2<u64> for usize
impl PowerOf2<u64> for usize
sourcefn power_of_2(pow: u64) -> usize
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.
sourceimpl PowerOf2<u64> for i8
impl PowerOf2<u64> for i8
sourcefn power_of_2(pow: u64) -> i8
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.
sourceimpl PowerOf2<u64> for i16
impl PowerOf2<u64> for i16
sourcefn power_of_2(pow: u64) -> i16
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.
sourceimpl PowerOf2<u64> for i32
impl PowerOf2<u64> for i32
sourcefn power_of_2(pow: u64) -> i32
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.
sourceimpl PowerOf2<u64> for i64
impl PowerOf2<u64> for i64
sourcefn power_of_2(pow: u64) -> i64
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.
sourceimpl PowerOf2<u64> for i128
impl PowerOf2<u64> for i128
sourcefn power_of_2(pow: u64) -> i128
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.
sourceimpl PowerOf2<u64> for isize
impl PowerOf2<u64> for isize
sourcefn power_of_2(pow: u64) -> isize
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.
sourceimpl PowerOf2<i64> for f32
impl PowerOf2<i64> for f32
sourcefn power_of_2(pow: i64) -> f32
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.
sourceimpl PowerOf2<i64> for f64
impl PowerOf2<i64> for f64
sourcefn power_of_2(pow: i64) -> f64
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.