OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libm/] [common/] [s_isinf.c] - Blame information for rev 310

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
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
 * <ieeefp.h>.  Newlib supplies it here as a function if the user
8
 * chooses to use <ieeefp.h> or needs to link older code compiled with the
9
 * previous <math.h> declaration.
10
 */
11
 
12
#include "fdlibm.h"
13
#include <ieeefp.h>
14
 
15
#ifndef _DOUBLE_IS_32BITS
16
 
17
int
18
_DEFUN (isinf, (x),
19
        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 */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.