[−][src]Trait fixed::traits::FixedUnsigned
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 is_power_of_two(self) -> bool
Returns true
if the fixed-point number is
2k for some integer k.
fn next_power_of_two(self) -> Self
Returns the smallest power of two that is ≥ self
.
fn checked_next_power_of_two(self) -> Option<Self>
Returns the smallest power of two that is ≥ self
, or None
if the
next power of two is too large to represent.
fn wrapping_next_power_of_two(self) -> Self
Returns the smallest power of two that is ≥ self
, wrapping
to 0 if the next power of two is too large to represent.
fn unwrapped_next_power_of_two(self) -> Self
Returns the smallest power of two that is ≥ self
, panicking
if the next power of two is too large to represent.
This method is only available when the unwrapped
experimental feature is enabled.
Panics
Panics if the result does not fit.