xref: /haiku/src/system/libroot/posix/glibc/arch/generic/s_isinff.c (revision 3cb015b1ee509d69c643506e8ff573808c86dcfc)
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  */
5 
6 #if defined(LIBM_SCCS) && !defined(lint)
7 static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $";
8 #endif
9 
10 /*
11  * isinff(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
19 __isinff (float x)
20 {
21 	int32_t ix,t;
22 	GET_FLOAT_WORD(ix,x);
23 	t = ix & 0x7fffffff;
24 	t ^= 0x7f800000;
25 	t |= -t;
26 	return ~(t >> 31) & (ix >> 30);
27 }
28 hidden_def (__isinff)
29 weak_alias (__isinff, isinff)
30