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
commit28a5409787b9a9f288ec7a2e53ec32e212e6ca4c (patch)
treeea52b0dcf553af00004bbb1e174b55f8e452b2a8 /sal
parent47b5eed7121305d375cfc9a6fd1ba21ff1430130 (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 6b20f50aa..f180369a9 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 */