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 Jakub Jelinek <jj@ultra.linux.cz>
00004  * Public domain.
00005  */
00006 
00007 #if defined(LIBM_SCCS) && !defined(lint)
00008 static char rcsid[] = "$NetBSD: $";
00009 #endif
00010 
00011 /*
00012  * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
00013  * no branching!
00014  */
00015 
00016 #include "math.h"
00017 #include "math_private.h"
00018 
00019 int
00020 __isinfl (long double x)
00021 {
00022        int64_t hx,lx;
00023        GET_LDOUBLE_WORDS64(hx,lx,x);
00024        lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
00025        lx |= -lx;
00026        return ~(lx >> 63) & (hx >> 62);
00027 }
00028 hidden_def (__isinfl)
00029 weak_alias (__isinfl, isinfl)