changeset 21232:b8cf410b5c88

eliminate feature tests from lo-mappers.h * lo-mappers.h, lo-mappers.cc (xisinf, xisnan, xfinite): Move feature tests inside functions in lo-mappers.cc.
author John W. Eaton <jwe@octave.org>
date Tue, 09 Feb 2016 04:55:29 -0500
parents 5f318c8ec634
children 20a824cd1d9e
files liboctave/numeric/lo-mappers.cc liboctave/numeric/lo-mappers.h
diffstat 2 files changed, 24 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/numeric/lo-mappers.cc	Tue Feb 09 04:15:50 2016 -0500
+++ b/liboctave/numeric/lo-mappers.cc	Tue Feb 09 04:55:29 2016 -0500
@@ -139,29 +139,35 @@
 
 // double -> bool mappers.
 
-#if ! defined (HAVE_CMATH_ISNAN)
 bool
 xisnan (double x)
 {
+#if defined (HAVE_CMATH_ISNAN)
+  return std::isnan (x);
+#else
   return lo_ieee_isnan (x);
-}
 #endif
+}
 
-#if ! defined (HAVE_CMATH_ISFINITE)
 bool
 xfinite (double x)
 {
+#if defined (HAVE_CMATH_ISFINITE)
+  return std::isfinite (x);
+#else
   return lo_ieee_finite (x);
-}
 #endif
+}
 
-#if ! defined (HAVE_CMATH_ISINF)
 bool
 xisinf (double x)
 {
+#if defined (HAVE_CMATH_ISINF)
+  return std::isinf (x);
+#else
   return lo_ieee_isinf (x);
+#endif
 }
-#endif
 
 bool
 octave_is_NA (double x)
@@ -358,29 +364,35 @@
 
 // float -> bool mappers.
 
-#if ! defined (HAVE_CMATH_ISNANF)
 bool
 xisnan (float x)
 {
+#if defined (HAVE_CMATH_ISNANF)
+  return std::isnan (x);
+#else
   return lo_ieee_isnan (x);
-}
 #endif
+}
 
-#if ! defined (HAVE_CMATH_ISFINITEF)
 bool
 xfinite (float x)
 {
+#if defined (HAVE_CMATH_ISFINITEF)
+  return std::isfinite (x);
+#else
   return lo_ieee_finite (x);
-}
 #endif
+}
 
-#if ! defined (HAVE_CMATH_ISINFF)
 bool
 xisinf (float x)
 {
+#if defined (HAVE_CMATH_ISINFF)
+  return std::isinf (x);
+#else
   return lo_ieee_isinf (x);
+#endif
 }
-#endif
 
 bool
 octave_is_NA (float x)
--- a/liboctave/numeric/lo-mappers.h	Tue Feb 09 04:15:50 2016 -0500
+++ b/liboctave/numeric/lo-mappers.h	Tue Feb 09 04:55:29 2016 -0500
@@ -53,24 +53,9 @@
 inline bool xisnan (bool) { return false; }
 inline bool xisnan (char) { return false; }
 
-#if defined (HAVE_CMATH_ISNAN)
-inline bool xisnan (double x)
-{ return std::isnan (x); }
-#else
 extern OCTAVE_API bool xisnan (double x);
-#endif
-#if defined (HAVE_CMATH_ISFINITE)
-inline bool xfinite (double x)
-{ return std::isfinite (x); }
-#else
 extern OCTAVE_API bool xfinite (double x);
-#endif
-#if defined (HAVE_CMATH_ISINF)
-inline bool xisinf (double x)
-{ return std::isinf (x); }
-#else
 extern OCTAVE_API bool xisinf (double x);
-#endif
 
 extern OCTAVE_API bool octave_is_NA (double x);
 
@@ -131,24 +116,9 @@
 extern OCTAVE_API FloatComplex xlog2 (const FloatComplex& x, int& exp);
 extern OCTAVE_API float xexp2 (float x);
 
-#if defined (HAVE_CMATH_ISNANF)
-inline bool xisnan (float x)
-{ return std::isnan (x); }
-#else
 extern OCTAVE_API bool xisnan (float x);
-#endif
-#if defined (HAVE_CMATH_ISFINITEF)
-inline bool xfinite (float x)
-{ return std::isfinite (x); }
-#else
 extern OCTAVE_API bool xfinite (float x);
-#endif
-#if defined (HAVE_CMATH_ISINFF)
-inline bool xisinf (float x)
-{ return std::isinf (x); }
-#else
 extern OCTAVE_API bool xisinf (float x);
-#endif
 
 extern OCTAVE_API bool octave_is_NA (float x);