From: Adhemerval Zanella Date: Fri, 10 Oct 2025 16:16:33 +0000 (-0300) Subject: math: Use stdbit.h instead of builtin in math_config.h X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6610a293b3a1a868448612d981a7f2e9721e32c0;p=thirdparty%2Fglibc.git math: Use stdbit.h instead of builtin in math_config.h Reviewed-by: Wilco Dijkstra --- diff --git a/sysdeps/ieee754/flt-32/math_config.h b/sysdeps/ieee754/flt-32/math_config.h index 6bb5c3324c..230aee591c 100644 --- a/sysdeps/ieee754/flt-32/math_config.h +++ b/sysdeps/ieee754/flt-32/math_config.h @@ -23,6 +23,7 @@ #include #include #include +#include #ifndef WANT_ROUNDING /* Correct special case results in non-nearest rounding modes. */ @@ -77,7 +78,7 @@ roundeven_finite (double x) { union { double f; uint64_t i; } u = {y}; union { double f; uint64_t i; } v = {y - copysign (1.0, x)}; - if (__builtin_ctzll (v.i) > __builtin_ctzll (u.i)) + if (stdc_trailing_zeros (v.i) > stdc_trailing_zeros (u.i)) y = v.f; } return y; @@ -101,8 +102,8 @@ roundevenf_finite (float x) if (fabs (x - y) == 0.5) { union { float f; uint32_t i; } u = {y}; - union { float f; uint32_t i; } v = {y - copysignf (1.0, x)}; - if (__builtin_ctzl (v.i) > __builtin_ctzl (u.i)) + union { float f; uint32_t i; } v = {y - copysignf (1.0f, x)}; + if (stdc_trailing_zeros (v.i) > stdc_trailing_zeros (u.i)) y = v.f; } return y;