From 8c674c5d84915bcec29ebb6c38266afbfd26036f Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 10 Nov 2010 10:21:08 +0800 Subject: [PATCH] gtklabel.c: Added hack for rint() --- gtk/gtklabel.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index f024b2847e..39655b8518 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -51,6 +51,24 @@ #include "gtktooltip.h" #include "gtkprivate.h" +/*rint() is only available in GCC and/or C99*/ +#if (__STDC_VERSION__ < 199901L && !defined __GNUC__) +double rint(double x) +{ + if (ceil(x+0.5) == floor(x+0.5)) + { + int a = (int)ceil(x); + if (a%2 == 0) + return ceil(x); + else + return floor(x); + } + else + return floor(x+0.5); +} +#endif + + struct _GtkLabelPrivate {