Back to index

glibc  2.9
s_isinfl.c
Go to the documentation of this file.
00001 /*
00002  * Written by J.T. Conklin <jtc@netbsd.org>.
00003  * Change for long double by Ulrich Drepper <drepper@cygnus.com>.
00004  * Intel i387 specific version.
00005  * Public domain.
00006  */
00007 
00008 #if defined(LIBM_SCCS) && !defined(lint)
00009 static char rcsid[] = "$NetBSD: $";
00010 #endif
00011 
00012 /*
00013  * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
00014  * no branching!
00015  */
00016 
00017 #include "math.h"
00018 #include "math_private.h"
00019 
00020 #ifdef __STDC__
00021        int __isinfl(long double x)
00022 #else
00023        int __isinfl(x)
00024        long double x;
00025 #endif
00026 {
00027        int32_t se,hx,lx;
00028        GET_LDOUBLE_WORDS(se,hx,lx,x);
00029        /* This additional ^ 0x80000000 is necessary because in Intel's
00030           internal representation of the implicit one is explicit.  */
00031        lx |= (hx ^ 0x80000000) | ((se & 0x7fff) ^ 0x7fff);
00032        lx |= -lx;
00033        se &= 0x8000;
00034        return ~(lx >> 31) & (1 - (se >> 14));
00035 }
00036 hidden_def (__isinfl)
00037 weak_alias (__isinfl, isinfl)