1 | /* |
2 | * Public domain. |
3 | */ |
4 | |
5 | #if defined(LIBM_SCCS) && !defined(lint) |
6 | static char rcsid[] = "$NetBSD: $" ; |
7 | #endif |
8 | |
9 | /* |
10 | * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0; |
11 | * no branching! |
12 | * slightly dodgy in relying on signed shift right copying sign bit |
13 | */ |
14 | |
15 | #include <math.h> |
16 | #include <math_private.h> |
17 | #include <math_ldbl_opt.h> |
18 | |
19 | int |
20 | ___isinfl (long double x) |
21 | { |
22 | double xhi; |
23 | int64_t hx, mask; |
24 | |
25 | xhi = ldbl_high (x); |
26 | EXTRACT_WORDS64 (hx, xhi); |
27 | |
28 | mask = (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL; |
29 | mask |= -mask; |
30 | mask >>= 63; |
31 | return ~mask & (hx >> 62); |
32 | } |
33 | hidden_ver (___isinfl, __isinfl) |
34 | #if !IS_IN (libm) |
35 | weak_alias (___isinfl, ____isinfl) |
36 | long_double_symbol (libc, ___isinfl, isinfl); |
37 | long_double_symbol (libc, ____isinfl, __isinfl); |
38 | #endif |
39 | |