From 8dba5486288e719ed290cccefcd932ed32756d7c Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 4 Sep 2013 17:36:00 +0000 Subject: math: cosmetic cleanup (use explicit union instead of fshape and dshape) --- src/math/copysignf.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/math/copysignf.c') diff --git a/src/math/copysignf.c b/src/math/copysignf.c index 47ab37e4..0af6ae9b 100644 --- a/src/math/copysignf.c +++ b/src/math/copysignf.c @@ -1,11 +1,10 @@ -#include "libm.h" +#include +#include -float copysignf(float x, float y) { - union fshape ux, uy; - - ux.value = x; - uy.value = y; - ux.bits &= (uint32_t)-1>>1; - ux.bits |= uy.bits & (uint32_t)1<<31; - return ux.value; +float copysignf(float x, float y) +{ + union {float f; uint32_t i;} ux={x}, uy={y}; + ux.i &= 0x7fffffff; + ux.i |= uy.i & 0x80000000; + return ux.f; } -- cgit v1.2.1