Skip to content

Tracking Issue for NonZeroUn::is_power_of_two (feature nonzero_is_power_of_two) #81106

Closed
@scottmcm

Description

@scottmcm

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

Unresolved Questions

  • None yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions