summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2011-06-14 01:48:29 +0300
committerTor Lillqvist <tml@iki.fi>2011-06-14 01:48:29 +0300
commitb6dffaf8f81ef07e048089eccda272750984d944 (patch)
tree99770e97592197e96cf91f4f683c2cb2d08efce2 /sal
parent9fda49de9c882dfc34c43e4ab936bfc9d5cfb8be (diff)
Fix SAL_MATH_FINITE definition for iOS
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/sal/mathconf.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/sal/inc/sal/mathconf.h b/sal/inc/sal/mathconf.h
index f32b2d6c8d6c..d673f34ed473 100644
--- a/sal/inc/sal/mathconf.h
+++ b/sal/inc/sal/mathconf.h
@@ -62,7 +62,15 @@ extern "C" {
#if defined( WNT)
#define SAL_MATH_FINITE(d) _finite(d)
#elif defined IOS
-#define SAL_MATH_FINITE(d) isfinite(d)
+/* C++ is so nice. This is the only way I could come up with making
+ * this actually work in all cases (?), even when <cmath> has been
+ * included which #undefs isfinite: copy the definition of isfinite()
+ * from <architecture/arm/math.h>
+ */
+#define SAL_MATH_FINITE(d) \
+ ( sizeof (d) == sizeof(float ) ? __inline_isfinitef((float)(d)) \
+ : sizeof (d) == sizeof(double) ? __inline_isfinited((double)(d)) \
+ : __inline_isfinite ((long double)(d)))
#elif defined LINUX || defined UNX
#define SAL_MATH_FINITE(d) finite(d)
#else /* WNT, LINUX, UNX */