40 #endif |
40 #endif |
41 } split; |
41 } split; |
42 } DoubleIntConv; |
42 } DoubleIntConv; |
43 |
43 |
44 static inline int high(double d) { |
44 static inline int high(double d) { |
45 DoubleIntConv x = { d }; |
45 DoubleIntConv x; |
|
46 x.d = d; |
46 return x.split.hi; |
47 return x.split.hi; |
47 } |
48 } |
48 |
49 |
49 static inline int low(double d) { |
50 static inline int low(double d) { |
50 DoubleIntConv x = { d }; |
51 DoubleIntConv x; |
|
52 x.d = d; |
51 return x.split.lo; |
53 return x.split.lo; |
52 } |
54 } |
53 |
55 |
54 static inline void set_high(double* d, int high) { |
56 static inline void set_high(double* d, int high) { |
55 DoubleIntConv conv = { *d }; |
57 DoubleIntConv conv; |
|
58 conv.d = *d; |
56 conv.split.hi = high; |
59 conv.split.hi = high; |
57 *d = conv.d; |
60 *d = conv.d; |
58 } |
61 } |
59 |
62 |
60 static inline void set_low(double* d, int low) { |
63 static inline void set_low(double* d, int low) { |
61 DoubleIntConv conv = { *d }; |
64 DoubleIntConv conv; |
|
65 conv.d = *d; |
62 conv.split.lo = low; |
66 conv.split.lo = low; |
63 *d = conv.d; |
67 *d = conv.d; |
64 } |
68 } |
65 |
69 |
66 static double copysignA(double x, double y) { |
70 static double copysignA(double x, double y) { |
67 DoubleIntConv convX = { x }; |
71 DoubleIntConv convX; |
|
72 convX.d = x; |
68 convX.split.hi = (convX.split.hi & 0x7fffffff) | (high(y) & 0x80000000); |
73 convX.split.hi = (convX.split.hi & 0x7fffffff) | (high(y) & 0x80000000); |
69 return convX.d; |
74 return convX.d; |
70 } |
75 } |
71 |
76 |
72 /* |
77 /* |