From 1ca149f22f82ae5eab823d7237cab046a6a6d337 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 5 Mar 2018 20:26:26 +0000 Subject: [PATCH] copysign: make it friendly to non 64bit capable platforms --- Library/libs/copysign.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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; } -- 2.34.1