public
/
FUZIX.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
439053a
)
copysign: make it friendly to non 64bit capable platforms
author
Alan Cox
<alan@linux.intel.com>
Mon, 5 Mar 2018 20:26:26 +0000
(20:26 +0000)
committer
Alan Cox
<alan@linux.intel.com>
Mon, 5 Mar 2018 20:26:26 +0000
(20:26 +0000)
Library/libs/copysign.c
patch
|
blob
|
history
diff --git
a/Library/libs/copysign.c
b/Library/libs/copysign.c
index
28dc172
..
1b3f892
100644
(file)
--- a/
Library/libs/copysign.c
+++ b/
Library/libs/copysign.c
@@
-4,11
+4,10
@@
#include "libm.h"
double copysign(double x, double y) {
- union dshape ux, uy;
-
- ux.value = x;
- uy.value = y;
- ux.bits &= (uint64_t)-1>>1;
- ux.bits |= uy.bits & (uint64_t)1<<63;
- return ux.value;
+ uint32_t hi;
+ uint32_t his;
+ GET_HIGH_WORD(x, hi);
+ GET_HIGH_WORD(y, his);
+ SET_HIGH_WORD(x, (hi & 0x7FFFFFFFUL) | (his & 0x80000000UL));
+ return x;
}