Skip to content

Compute "round down to next multiple of alignment" more efficiently #390

@joshlf

Description

@joshlf
fn round_down_to_next_multiple_of_alignment(n: usize, align: NonZeroUsize) -> usize {
    let mask = !(align.get() - 1);
    n & mask
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions