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