From: Alan Cox Date: Mon, 5 Mar 2018 20:26:26 +0000 (+0000) Subject: copysign: make it friendly to non 64bit capable platforms X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=1ca149f22f82ae5eab823d7237cab046a6a6d337;p=FUZIX.git copysign: make it friendly to non 64bit capable platforms --- diff --git a/Library/libs/copysign.c b/Library/libs/copysign.c index 28dc1723..1b3f8922 100644 --- 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; }