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