summaryrefslogtreecommitdiff
path: root/src/math/copysignf.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2013-09-04 17:36:00 +0000
committerSzabolcs Nagy <nsz@port70.net>2013-09-05 11:30:09 +0000
commit8dba5486288e719ed290cccefcd932ed32756d7c (patch)
tree7e9cac9140e4c2c54e31cd817e95e135833a0deb /src/math/copysignf.c
parent63b9cc777323488da3474e8bc53e0ac4d3521382 (diff)
downloadmusl-8dba5486288e719ed290cccefcd932ed32756d7c.tar.gz
math: cosmetic cleanup (use explicit union instead of fshape and dshape)
Diffstat (limited to 'src/math/copysignf.c')
-rw-r--r--src/math/copysignf.c17
1 files changed, 8 insertions, 9 deletions
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 <math.h>
+#include <stdint.h>
-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;
}