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

Rely on defined saturation behavior for f32 to u8 casts #87

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

waywardmonkeys
Copy link
Collaborator

This is a backport of a change from Raph made in the CPU sparse strips experiment.

When converting from f32 to u8, the code was clamping to be sure that the values were within range. This was necessary in the past, but hasn't been needed for some years now, since rust-lang/rust#10184. This clamping is not necessary and the compiler is not optimizing it away as of Rust 1.83 on Apple Silicon.

This is a backport of a change from Raph made in the CPU
sparse strips experiment.

When converting from `f32` to `u8`, the code was clamping to
be sure that the values were within range. This was necessary
in the past, but hasn't been needed for some years now, since
<rust-lang/rust#10184>. This clamping
is not necessary and the compiler is not optimizing it away
as of Rust 1.83 on Apple Silicon.
@waywardmonkeys waywardmonkeys added this pull request to the merge queue Dec 11, 2024
Merged via the queue into linebender:main with commit 9a7727a Dec 11, 2024
15 checks passed
@waywardmonkeys waywardmonkeys deleted the to_rgba8_saturation branch December 11, 2024 14:50
@waywardmonkeys waywardmonkeys added this to the 0.2.0 milestone Dec 17, 2024
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.

3 participants