Skip to content

SIL: avoid truncation warnings on Windows (NFCI) #78060

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

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Dec 9, 2024

enum is a signed integer type on some platforms. The return value of std::numeric_limits<T>::max() is a size_t which is unsigned. Further manipulation retains the unsigned-ness until the assignment which results in truncation. Change the type to a constexpr constant definition and remove the enum type along with a type conversion to an explicitly unsigned integral type.

`enum` is a signed integer type on some platforms. The return value of
`std::numeric_limits<T>::max()` is a `size_t` which is unsigned. Further
manipulation retains the unsigned-ness until the assignment which
results in truncation. Change the type to a `constexpr` constant
definition and remove the `enum` type along with a type conversion to an
explicitly unsigned integral type.
@compnerd compnerd requested a review from jckarter as a code owner December 9, 2024 16:29
@compnerd
Copy link
Member Author

compnerd commented Dec 9, 2024

@swift-ci please test

@compnerd compnerd merged commit c711df6 into swiftlang:main Dec 10, 2024
5 checks passed
@compnerd compnerd deleted the truncatio branch December 10, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant