about summary refs log tree commit diff
path: root/src/math
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2013-09-04 16:39:41 +0000
committerSzabolcs Nagy <nsz@port70.net>2013-09-05 11:30:08 +0000
commit63b9cc777323488da3474e8bc53e0ac4d3521382 (patch)
treeb82e0a0dd1f887c53e915d67d554b93d9feb4a86 /src/math
parent94a3d13ae69764c0e2b67c6e17dc5126e103d0e3 (diff)
downloadmusl-63b9cc777323488da3474e8bc53e0ac4d3521382.tar.gz
musl-63b9cc777323488da3474e8bc53e0ac4d3521382.tar.xz
musl-63b9cc777323488da3474e8bc53e0ac4d3521382.zip
math: remove *_WORD64 macros from libm.h
only fma used these macros and the explicit union is clearer
Diffstat (limited to 'src/math')
-rw-r--r--src/math/fma.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/math/fma.c b/src/math/fma.c
index 1b1c1321..84868be5 100644
--- a/src/math/fma.c
+++ b/src/math/fma.c
@@ -232,16 +232,16 @@ static inline struct dd dd_add(double a, double b)
 static inline double add_adjusted(double a, double b)
 {
 	struct dd sum;
-	uint64_t hibits, lobits;
+	union {double f; uint64_t i;} uhi, ulo;
 
 	sum = dd_add(a, b);
 	if (sum.lo != 0) {
-		EXTRACT_WORD64(hibits, sum.hi);
-		if ((hibits & 1) == 0) {
+		uhi.f = sum.hi;
+		if ((uhi.i & 1) == 0) {
 			/* hibits += (int)copysign(1.0, sum.hi * sum.lo) */
-			EXTRACT_WORD64(lobits, sum.lo);
-			hibits += 1 - ((hibits ^ lobits) >> 62);
-			INSERT_WORD64(sum.hi, hibits);
+			ulo.f = sum.lo;
+			uhi.i += 1 - ((uhi.i ^ ulo.i) >> 62);
+			sum.hi = uhi.f;
 		}
 	}
 	return (sum.hi);
@@ -255,7 +255,7 @@ static inline double add_adjusted(double a, double b)
 static inline double add_and_denormalize(double a, double b, int scale)
 {
 	struct dd sum;
-	uint64_t hibits, lobits;
+	union {double f; uint64_t i;} uhi, ulo;
 	int bits_lost;
 
 	sum = dd_add(a, b);
@@ -271,13 +271,13 @@ static inline double add_and_denormalize(double a, double b, int scale)
 	 * break the ties manually.
 	 */
 	if (sum.lo != 0) {
-		EXTRACT_WORD64(hibits, sum.hi);
-		bits_lost = -((int)(hibits >> 52) & 0x7ff) - scale + 1;
-		if (bits_lost != 1 ^ (int)(hibits & 1)) {
+		uhi.f = sum.hi;
+		bits_lost = -((int)(uhi.i >> 52) & 0x7ff) - scale + 1;
+		if (bits_lost != 1 ^ (int)(uhi.i & 1)) {
 			/* hibits += (int)copysign(1.0, sum.hi * sum.lo) */
-			EXTRACT_WORD64(lobits, sum.lo);
-			hibits += 1 - (((hibits ^ lobits) >> 62) & 2);
-			INSERT_WORD64(sum.hi, hibits);
+			ulo.f = sum.lo;
+			uhi.i += 1 - (((uhi.i ^ ulo.i) >> 62) & 2);
+			sum.hi = uhi.f;
 		}
 	}
 	return scalbn(sum.hi, scale);