if (__glibc_unlikely (mx == 0))
return asdouble (sx);
- int shift = clz_uint64 (mx);
+ int shift = stdc_leading_zeros (mx);
ex -= shift + 1;
mx <<= shift;
mx = sx | (mx >> EXPONENT_WIDTH);
my = hy;
ey = 0;
exp_diff--;
- lead_zeros_my = clz_uint64 (my);
+ lead_zeros_my = stdc_leading_zeros (my);
}
- int tail_zeros_my = ctz_uint64 (my);
+ int tail_zeros_my = stdc_trailing_zeros (my);
int sides_zeroes = lead_zeros_my + tail_zeros_my;
int right_shift = exp_diff < tail_zeros_my ? exp_diff : tail_zeros_my;
#include <math_private.h>
#include <nan-high-order-bit.h>
#include <stdint.h>
+#include <stdbit.h>
#ifndef WANT_ROUNDING
/* Correct special case results in non-nearest rounding modes. */
# define TOINT_INTRINSICS 0
#endif
-static inline int
-clz_uint64 (uint64_t x)
-{
- if (sizeof (uint64_t) == sizeof (unsigned long))
- return __builtin_clzl (x);
- else
- return __builtin_clzll (x);
-}
-
-static inline int
-ctz_uint64 (uint64_t x)
-{
- if (sizeof (uint64_t) == sizeof (unsigned long))
- return __builtin_ctzl (x);
- else
- return __builtin_ctzll (x);
-}
-
#if TOINT_INTRINSICS
/* Round x to nearest int in all rounding modes, ties have to be rounded
consistently with converttoint so the results match. If the result
static inline double
make_double (uint64_t x, int64_t ep, uint64_t s)
{
- int lz = clz_uint64 (x) - EXPONENT_WIDTH;
+ int lz = stdc_leading_zeros (x) - EXPONENT_WIDTH;
x <<= lz;
ep -= lz;