Skip to content

Deprecate math macros #4414

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 2 commits into from
Mar 10, 2025
Merged

Conversation

kleisauke
Copy link
Member

We can simply use the functions from <math.h> instead of conditionally relying on GCC and Clang's __builtin_* functions.

The likely reason for commit 90c1fb9 was due to https://sourceware.org/bugzilla/show_bug.cgi?id=17441, which was resolved in glibc 2.23.

Context: #4412 (comment).

We can simply use the functions from `<math.h>` instead of conditionally
relying on GCC and Clang's `__builtin_*` functions.

The likely reason for commit 90c1fb9
was due to https://sourceware.org/bugzilla/show_bug.cgi?id=17441, which
was resolved in glibc 2.23.
We also need to support floating-point arguments, so we can't use
`abs()` here, as it only works with integers.
@jcupitt
Copy link
Member

jcupitt commented Mar 9, 2025

Ah funny, __builtin used to be a lot faster back in the day. I read this quickly and it seems fine, so 👍 from me.

Yes, conceptually VIPS_ABS() is like VIPS_MAX() or VIPS_MIN(), and not like one of the math functions.

@jcupitt jcupitt merged commit 7a6eb29 into libvips:master Mar 10, 2025
6 checks passed
@kleisauke kleisauke deleted the deprecate-math-macros branch March 10, 2025 11:54
@kleisauke
Copy link
Member Author

Thanks! Note that when you merge 8.16 back into the master branch, it will likely conflict in ‎libvips/colour/LCh2UCS.c due to commit 82c7c05. In that case, fabsf() should be preferred over fabs().

@jcupitt
Copy link
Member

jcupitt commented Mar 10, 2025

Thanks for the tip! Done.

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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy