| 1 | /* |
| 2 | * Intel i387 specific version. |
| 3 | * Public domain. |
| 4 | */ |
| 5 | |
| 6 | #if defined(LIBM_SCCS) && !defined(lint) |
| 7 | static char rcsid[] = "$NetBSD: $" ; |
| 8 | #endif |
| 9 | |
| 10 | /* |
| 11 | * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0; |
| 12 | * no branching! |
| 13 | */ |
| 14 | |
| 15 | #include <math.h> |
| 16 | #include <math_private.h> |
| 17 | |
| 18 | int __isinfl(long double x) |
| 19 | { |
| 20 | int32_t se,hx,lx; |
| 21 | GET_LDOUBLE_WORDS(se,hx,lx,x); |
| 22 | /* This additional ^ 0x80000000 is necessary because in Intel's |
| 23 | internal representation of the implicit one is explicit. */ |
| 24 | lx |= (hx ^ 0x80000000) | ((se & 0x7fff) ^ 0x7fff); |
| 25 | lx |= -lx; |
| 26 | se &= 0x8000; |
| 27 | return ~(lx >> 31) & (1 - (se >> 14)); |
| 28 | } |
| 29 | hidden_def (__isinfl) |
| 30 | weak_alias (__isinfl, isinfl) |
| 31 | |