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

Split gd_color.c[ch] (sync with upstream) #17324

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

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Jan 2, 2025

I have no idea why this has diverged in the first place. Upstream introduced gd_color.[ch] already in 2008, while we have cropping support only since 2013. Anyhow, syncing with upstream now is better than never.

The code is the same, except for libgd/libgd@d500229, what I don't understand, since there has been no int division in the first place due to usual arithmetic conversions, but at least there is not even a minor BC break. (Also note that this calculation doesn't make much sense, see libgd/libgd#334).

One caveat, though: gd_color.h is now exported (see #16070; need to work on that).

@Girgias
Copy link
Member

Girgias commented Jan 2, 2025

My guess is that floating point division is one order of magnitude slower than multiplication: http://ithare.com/infographics-operation-costs-in-cpu-clock-cycles/

@cmb69
Copy link
Member Author

cmb69 commented Jan 2, 2025

Ah, thank you @Girgias, I wasn't aware of that (and misunderstood the commit message).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants