Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some usize-typed masks definitions agnostic to the size of usize #96081

Merged
merged 1 commit into from
Apr 16, 2022

Commits on Apr 15, 2022

  1. Make some usize-typed masks definition agnostic to the size of usize

    Some masks where defined as
    ```rust
    const NONASCII_MASK: usize = 0x80808080_80808080u64 as usize;
    ```
    where it was assumed that `usize` is never wider than 64, which is currently true.
    
    To make those constants valid in a hypothetical 128-bit target, these constants have been redefined in an `usize`-width-agnostic way
    ```rust
    const NONASCII_MASK: usize = usize::from_ne_bytes([0x80; size_of::<usize>()]);
    ```
    
    There are already some cases where Rust anticipates the possibility of supporting 128-bit targets, such as not implementing `From<usize>` for `u64`.
    eduardosm committed Apr 15, 2022
    Configuration menu
    Copy the full SHA
    93ae6f8 View commit details
    Browse the repository at this point in the history