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

Simplify RGB rounding in parser #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Simplify RGB rounding in parser #43

wants to merge 1 commit into from

Conversation

tomcur
Copy link
Member

@tomcur tomcur commented Jan 3, 2025

The cast to u8 is saturating, so some bounds checking can be dropped.

The division and multiplication in value / 100.0 * 255.0 are not collapsed, so it has the same rounding behavior as when using parse_number_or_percent.

The cast to `u8` is saturating, so some bounds checking can be dropped.

The division and multiplication in `value / 100.0 * 255.0` are not
collapsed, so it has the same rounding behavior as when using
`parse_number_or_percent`.
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