aboutsummaryrefslogtreecommitdiff
path: root/math/tgmath.h
diff options
context:
space:
mode:
Diffstat (limited to 'math/tgmath.h')
-rw-r--r--math/tgmath.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/math/tgmath.h b/math/tgmath.h
index a70dfe1f47..a0da104142 100644
--- a/math/tgmath.h
+++ b/math/tgmath.h
@@ -112,6 +112,18 @@
+ (__tgmath_real_type (Val2)) 0)) \
Fct##f (Val1, Val2)))
+# define __TGMATH_BINARY_REAL_RET_ONLY(Val1, Val2, Fct) \
+ (__extension__ (((sizeof (Val1) > sizeof (double) \
+ || sizeof (Val2) > sizeof (double)) \
+ && __builtin_classify_type ((Val1) + (Val2)) == 8) \
+ ? __tgml(Fct) (Val1, Val2) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ || __builtin_classify_type (Val1) != 8 \
+ || __builtin_classify_type (Val2) != 8) \
+ ? Fct (Val1, Val2) \
+ : Fct##f (Val1, Val2)))
+
# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
(__extension__ (((sizeof (Val1) > sizeof (double) \
|| sizeof (Val2) > sizeof (double)) \
@@ -471,12 +483,12 @@
# define fminmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminmag)
/* Total order operation. */
-# define totalorder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, \
- totalorder)
+# define totalorder(Val1, Val2) \
+ __TGMATH_BINARY_REAL_RET_ONLY (Val1, Val2, totalorder)
/* Total order operation on absolute values. */
-# define totalordermag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, \
- totalordermag)
+# define totalordermag(Val1, Val2) \
+ __TGMATH_BINARY_REAL_RET_ONLY (Val1, Val2, totalordermag)
#endif