Trait fixed::traits::FixedUnsigned [−][src]
pub trait FixedUnsigned: Fixed { fn significant_bits(self) -> u32; fn is_power_of_two(self) -> bool; fn highest_one(self) -> Self; fn next_power_of_two(self) -> Self; fn checked_next_power_of_two(self) -> Option<Self>; fn wrapping_next_power_of_two(self) -> Self; fn unwrapped_next_power_of_two(self) -> Self; }
This trait provides methods common to all unsigned fixed-point numbers.
Methods common to all fixed-point numbers including signed
fixed-point numbers are provided by the Fixed
supertrait.
This trait is sealed and cannot be implemented for more types; it
is implemented for FixedU8
, FixedU16
, FixedU32
,
FixedU64
, and FixedU128
.
Required methods
fn significant_bits(self) -> u32
[src]
Returns the number of bits required to represent the value.
See also
FixedU32::significant_bits
.
fn is_power_of_two(self) -> bool
[src]
Returns true
if the fixed-point number is
2k for some integer k.
See also
FixedU32::is_power_of_two
.
fn highest_one(self) -> Self
[src]
Returns the highest one in the binary representation, or zero
if self
is zero.
See also FixedU32::highest_one
.
fn next_power_of_two(self) -> Self
[src]
Returns the smallest power of two that is ≥ self
.
See also
FixedU32::next_power_of_two
.
fn checked_next_power_of_two(self) -> Option<Self>
[src]
Returns the smallest power of two that is ≥ self
, or None
if the
next power of two is too large to represent.
See also
FixedU32::checked_next_power_of_two
.
fn wrapping_next_power_of_two(self) -> Self
[src]
Returns the smallest power of two that is ≥ self
, wrapping
to 0 if the next power of two is too large to represent.
See also
FixedU32::wrapping_next_power_of_two
.
fn unwrapped_next_power_of_two(self) -> Self
[src]
Returns the smallest power of two that is ≥ self
, panicking
if the next power of two is too large to represent.
See also
FixedU32::unwrapped_next_power_of_two
.
Panics
Panics if the result does not fit.