Closed
Description
Feature gate: #![feature(nonzero_is_power_of_two)]
This is a tracking issue for NonZeroUsize::is_power_of_two
(and friends for the other unsigned types).
Like NonZeroUsize::leading_zeros
(#79143), this generates simpler code than the underlying integer type because it can avoid a separate zero check.
Public API
impl NonZeroUsize {
pub fn is_power_of_two(self) -> bool;
}
// And also for NonZeroU8, NonZeroU16, ...
Steps / History
- Implementation: Add NonZeroUn::is_power_of_two #81107
- Final commenting period (FCP)
- Stabilization PR
Unresolved Questions
- None yet.