summaryrefslogtreecommitdiff
path: root/gdk/fallback-c89.c
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2013-02-21 15:50:54 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2013-03-13 13:22:46 +0800
commit9b7c7ae614a0865f613fc6b3f2596d86f23271bb (patch)
treec2b964bdfbb6d08b8da71594f56182fc2a136c1c /gdk/fallback-c89.c
parent5e2c23214564f7dcc687fa8467020eeb6b9407a9 (diff)
downloadgtk+-9b7c7ae614a0865f613fc6b3f2596d86f23271bb.tar.gz
gdk/fallback-c89.c: Add fallback for round()
This is essentially done by simply copying from gtk/fallback-c89.c https://bugzilla.gnome.org/show_bug.cgi?id=694339
Diffstat (limited to 'gdk/fallback-c89.c')
-rw-r--r--gdk/fallback-c89.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdk/fallback-c89.c b/gdk/fallback-c89.c
index b150044bd3..4baf797f3c 100644
--- a/gdk/fallback-c89.c
+++ b/gdk/fallback-c89.c
@@ -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