Skip to content

next_power_of_two should panic on overflow #18604

Closed
@Gankra

Description

@Gankra

If you feed in a number such that the next_power_of_two would overflow, it spits out 0. I'm fine with that honestly, since it's easy to detect, but maybe that isn't what we want here. Maybe it should return a Result/Option/panic/saturate?

Should be specified so that the behaviour can be relied upon, or explicitly documented as unspecified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.P-mediumMedium priorityT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions