Rev 4872 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | /* |
2 | * isinf(x) returns 1 if x is infinity, else 0; |
||
3 | * no branching! |
||
4 | * |
||
5 | * isinf is a |
||
6 | * implemented as a function by newlib and is declared as such in |
||
7 | * |
||
8 | * chooses to use |
||
9 | * previous |
||
10 | */ |
||
11 | |||
12 | #include "fdlibm.h" |
||
13 | #include |
||
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 */ |