source: trunk/libs/newlib/src/newlib/libm/common/s_isinf.c @ 471

Last change on this file since 471 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 629 bytes
Line 
1/*
2 * isinf(x) returns 1 if x is infinity, else 0;
3 * no branching!
4 *
5 * isinf is a <math.h> macro in the C99 standard.  It was previously
6 * implemented as a function by newlib and is declared as such in
7 * <math.h>.  Newlib supplies it here as a function if the user
8 * chooses to use it instead of the C99 macro.
9 */
10
11#include "fdlibm.h"
12#include <ieeefp.h>
13
14#ifndef _DOUBLE_IS_32BITS
15
16#undef isinf
17
18int
19isinf (double x)
20{
21        __int32_t hx,lx;
22        EXTRACT_WORDS(hx,lx,x);
23        hx &= 0x7fffffff;
24        hx |= (__uint32_t)(lx|(-lx))>>31;       
25        hx = 0x7ff00000 - hx;
26        return 1 - (int)((__uint32_t)(hx|(-hx))>>31);
27}
28
29#endif /* _DOUBLE_IS_32BITS */
Note: See TracBrowser for help on using the repository browser.