update qm-dsp library
[ardour.git] / libs / qm-dsp / maths / nan-inf.h
index 8191713000ec04055a0f4141094c01a14b3c1476..c6be51276ab33b54ef7953e64fa8bd7857cc7742 100644 (file)
@@ -2,19 +2,12 @@
 #ifndef NAN_INF_H
 #define NAN_INF_H
 
-#include <math.h>
-
-#ifdef sun
-
-#include <ieeefp.h>
-#define ISNAN(x) ((sizeof(x)==sizeof(float))?isnanf(x):isnand(x))
-#define ISINF(x) (!finite(x))
-
-#else
-
-#define ISNAN(x) isnan(x)
-#define ISINF(x) isinf(x)
-
-#endif
+#define ISNAN(x) (sizeof(x) == sizeof(double) ? ISNANd(x) : ISNANf(x))
+static inline int ISNANf(float x) { return x != x; }
+static inline int ISNANd(double x) { return x != x; }
+          
+#define ISINF(x) (sizeof(x) == sizeof(double) ? ISINFd(x) : ISINFf(x))
+static inline int ISINFf(float x) { return !ISNANf(x) && ISNANf(x - x); }
+static inline int ISINFd(double x) { return !ISNANd(x) && ISNANd(x - x); }
 
 #endif