]> Pileus Git - ~andy/gtk/commitdiff
gtklabel.c: Added hack for rint()
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 10 Nov 2010 02:21:08 +0000 (10:21 +0800)
committerTristan Van Berkom <tristan.van.berkom@gmail.com>
Sat, 13 Nov 2010 06:23:31 +0000 (15:23 +0900)
gtk/gtklabel.c

index f024b2847e6732b7da77c39c8c35aa7af410e34d..39655b85180b939ea0987d988fa5d4ca4611a553 100644 (file)
 #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
 {