]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/compiler-rt/lib/ppc/DD.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / compiler-rt / lib / ppc / DD.h
1 #ifndef __DD_HEADER
2 #define __DD_HEADER
3
4 #include "../int_lib.h"
5
6 typedef union {
7         long double ld;
8         struct {
9                 double hi;
10                 double lo;
11         }s;
12 }DD;
13
14 typedef union { 
15         double d;
16         uint64_t x;
17 } doublebits;
18
19 #define LOWORDER(xy,xHi,xLo,yHi,yLo) \
20         (((((xHi)*(yHi) - (xy)) + (xHi)*(yLo)) + (xLo)*(yHi)) + (xLo)*(yLo))
21
22 static inline double __attribute__((always_inline))
23 fabs(double x)
24 {
25         doublebits result = { .d = x };
26         result.x &= UINT64_C(0x7fffffffffffffff);
27         return result.d;
28 }
29
30 static inline double __attribute__((always_inline))
31 high26bits(double x)
32 {
33         doublebits result = { .d = x };
34         result.x &= UINT64_C(0xfffffffff8000000);
35         return result.d;
36 }
37
38 static inline int __attribute__((always_inline))
39 different_sign(double x, double y)
40 {
41         doublebits xsignbit = { .d = x }, ysignbit = { .d = y };
42         int result = (int)(xsignbit.x >> 63) ^ (int)(ysignbit.x >> 63);
43         return result;
44 }
45
46 #endif /* __DD_HEADER */