Trait malachite_base::num::logic::traits::SignificantBits
source · [−]pub trait SignificantBits {
fn significant_bits(self) -> u64;
}
Required Methods
fn significant_bits(self) -> u64
fn significant_bits(self) -> u64
The number of bits it takes to represent self
.
Implementations on Foreign Types
sourceimpl SignificantBits for u8
impl SignificantBits for u8
sourcefn significant_bits(self) -> u64
fn significant_bits(self) -> u64
Returns the number of significant bits of an unsigned primitive integer.
This is the integer’s width minus the number of leading zeros.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 n \rfloor + 1 & \text{if} \quad n > 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl SignificantBits for u16
impl SignificantBits for u16
sourcefn significant_bits(self) -> u64
fn significant_bits(self) -> u64
Returns the number of significant bits of an unsigned primitive integer.
This is the integer’s width minus the number of leading zeros.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 n \rfloor + 1 & \text{if} \quad n > 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl SignificantBits for u32
impl SignificantBits for u32
sourcefn significant_bits(self) -> u64
fn significant_bits(self) -> u64
Returns the number of significant bits of an unsigned primitive integer.
This is the integer’s width minus the number of leading zeros.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 n \rfloor + 1 & \text{if} \quad n > 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl SignificantBits for u64
impl SignificantBits for u64
sourcefn significant_bits(self) -> u64
fn significant_bits(self) -> u64
Returns the number of significant bits of an unsigned primitive integer.
This is the integer’s width minus the number of leading zeros.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 n \rfloor + 1 & \text{if} \quad n > 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl SignificantBits for u128
impl SignificantBits for u128
sourcefn significant_bits(self) -> u64
fn significant_bits(self) -> u64
Returns the number of significant bits of an unsigned primitive integer.
This is the integer’s width minus the number of leading zeros.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 n \rfloor + 1 & \text{if} \quad n > 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl SignificantBits for usize
impl SignificantBits for usize
sourcefn significant_bits(self) -> u64
fn significant_bits(self) -> u64
Returns the number of significant bits of an unsigned primitive integer.
This is the integer’s width minus the number of leading zeros.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 n \rfloor + 1 & \text{if} \quad n > 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl SignificantBits for i8
impl SignificantBits for i8
Returns the number of significant bits of a signed primitive integer.
This is the integer’s width minus the number of leading zeros of its absolute value.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 |n| \rfloor + 1 & \text{if} \quad n \neq 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
fn significant_bits(self) -> u64
sourceimpl SignificantBits for i16
impl SignificantBits for i16
Returns the number of significant bits of a signed primitive integer.
This is the integer’s width minus the number of leading zeros of its absolute value.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 |n| \rfloor + 1 & \text{if} \quad n \neq 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
fn significant_bits(self) -> u64
sourceimpl SignificantBits for i32
impl SignificantBits for i32
Returns the number of significant bits of a signed primitive integer.
This is the integer’s width minus the number of leading zeros of its absolute value.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 |n| \rfloor + 1 & \text{if} \quad n \neq 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
fn significant_bits(self) -> u64
sourceimpl SignificantBits for i64
impl SignificantBits for i64
Returns the number of significant bits of a signed primitive integer.
This is the integer’s width minus the number of leading zeros of its absolute value.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 |n| \rfloor + 1 & \text{if} \quad n \neq 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
fn significant_bits(self) -> u64
sourceimpl SignificantBits for i128
impl SignificantBits for i128
Returns the number of significant bits of a signed primitive integer.
This is the integer’s width minus the number of leading zeros of its absolute value.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 |n| \rfloor + 1 & \text{if} \quad n \neq 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
fn significant_bits(self) -> u64
sourceimpl SignificantBits for isize
impl SignificantBits for isize
Returns the number of significant bits of a signed primitive integer.
This is the integer’s width minus the number of leading zeros of its absolute value.
$$ f(n) = \begin{cases} 0 & \text{if} \quad n = 0, \\ \lfloor \log_2 |n| \rfloor + 1 & \text{if} \quad n \neq 0. \end{cases} $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.