about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-30 23:33:00 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-30 23:33:00 -0400
commit93a18a15e4428d4fe3f239081e0218ac0c69f458 (patch)
tree53b912e88de9248ad3f05da0555c507e056567ba
parent7eabe8e69044e3683376165934a17210b6b148b9 (diff)
downloadmusl-93a18a15e4428d4fe3f239081e0218ac0c69f458.tar.gz
musl-93a18a15e4428d4fe3f239081e0218ac0c69f458.tar.xz
musl-93a18a15e4428d4fe3f239081e0218ac0c69f458.zip
make math.h more c++-friendly
-rw-r--r--include/math.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/math.h b/include/math.h
index e7220aeb..8791bba8 100644
--- a/include/math.h
+++ b/include/math.h
@@ -41,8 +41,11 @@ int __fpclassify(double);
 int __fpclassifyf(float);
 int __fpclassifyl(long double);
 
-#define __FLOAT_BITS(f) (((union { float __f; __uint32_t __i; }){ (float)(f) }).__i)
-#define __DOUBLE_BITS(f) (((union { double __f; __uint64_t __i; }){ (double)(f) }).__i)
+union __float_repr { float __f; __uint32_t __i; };
+union __double_repr { double __f; __uint64_t __i; };
+
+#define __FLOAT_BITS(f) (((union __float_repr){ (float)(f) }).__i)
+#define __DOUBLE_BITS(f) (((union __double_repr){ (double)(f) }).__i)
 
 #define fpclassify(x) ( \
 	sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \