]> Pileus Git - ~andy/gtk/blobdiff - gdk/fallback-c89.c
Include config.h in gdkenumtypes.c.template
[~andy/gtk] / gdk / fallback-c89.c
index 35dea777ed39920ccab1c04660ad23a04ab8ab7e..4baf797f3c2eceeaddb2da8c773b1efcd7bd05c0 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <float.h>
 
-#ifndef HAVE_ISNAN
+#ifndef HAVE_DECL_ISNAN
 /* it seems of the supported compilers only
  * MSVC does not have isnan(), but it does
  * have _isnan() which does the same as isnan()
@@ -31,7 +31,7 @@ isnan (double x)
 }
 #endif
 
-#ifndef HAVE_ISINF
+#ifndef HAVE_DECL_ISINF
 /* Unfortunately MSVC does not have finite()
  * but it does have _finite() which is the same
  * as finite() except when x is a NaN
@@ -42,3 +42,15 @@ isinf (double x)
   return (!_finite (x) && !_isnan (x));
 }
 #endif
+
+/* Workaround for round() for non-GCC/non-C99 compilers */
+#ifndef HAVE_ROUND
+static inline double
+round (double x)
+{
+  if (x >= 0)
+    return floor (x + 0.5);
+  else
+    return ceil (x - 0.5);
+}
+#endif