| 1 | /* |
| 2 | * Public domain. |
| 3 | */ |
| 4 | |
| 5 | #if defined(LIBM_SCCS) && !defined(lint) |
| 6 | static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $" ; |
| 7 | #endif |
| 8 | |
| 9 | /* |
| 10 | * isinff(x) returns 1 if x is inf, -1 if x is -inf, else 0; |
| 11 | * no branching! |
| 12 | */ |
| 13 | |
| 14 | #include <math.h> |
| 15 | #include <math_private.h> |
| 16 | |
| 17 | int |
| 18 | __isinff (float x) |
| 19 | { |
| 20 | int32_t ix,t; |
| 21 | GET_FLOAT_WORD(ix,x); |
| 22 | t = ix & 0x7fffffff; |
| 23 | t ^= 0x7f800000; |
| 24 | t |= -t; |
| 25 | return ~(t >> 31) & (ix >> 30); |
| 26 | } |
| 27 | hidden_def (__isinff) |
| 28 | weak_alias (__isinff, isinff) |
| 29 | |