[PATCH] float128: Extend __MATH_TG for float128 support
Gabriel F. T. Gomes
gftg@linux.vnet.ibm.com
Mon May 15 21:04:00 GMT 2017
2017-02-23 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* math/math.h (__MATH_TG): Extend the conditions to add
_Float128 support.
---
math/math.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/math/math.h b/math/math.h
index 2d1508e..af99e8b 100644
--- a/math/math.h
+++ b/math/math.h
@@ -343,6 +343,27 @@ extern int signgam;
#ifdef __NO_LONG_DOUBLE_MATH
# define __MATH_TG(TG_ARG, FUNC, ARGS) \
(sizeof (TG_ARG) == sizeof (float) ? FUNC ## f ARGS : FUNC ARGS)
+#elif __HAVE_DISTINCT_FLOAT128
+# if __USE_ISOC11
+# define __MATH_TG(TG_ARG, FUNC, ARGS) \
+ _Generic ((TG_ARG), \
+ float: FUNC ## f ARGS, \
+ default: FUNC ARGS, \
+ long double: FUNC ## l ARGS, \
+ _Float128: FUNC ## f128 ARGS)
+# else
+# define __MATH_TG(TG_ARG, FUNC, ARGS) \
+ __builtin_choose_expr \
+ (__builtin_types_compatible_p (__typeof (TG_ARG), float), \
+ FUNC ## f ARGS, \
+ __builtin_choose_expr \
+ (__builtin_types_compatible_p (__typeof (TG_ARG), double), \
+ FUNC ARGS, \
+ __builtin_choose_expr \
+ (__builtin_types_compatible_p (__typeof (TG_ARG), long double), \
+ FUNC ## l ARGS, \
+ FUNC ## f128 ARGS)))
+# endif
#else
# define __MATH_TG(TG_ARG, FUNC, ARGS) \
(sizeof (TG_ARG) == sizeof (float) \
--
2.4.11
More information about the Libc-alpha
mailing list