[gtk+/treeview-refactor] gtklabel.c: Added hack for rint()



commit 14a40180cd1879bb8d9c464e2d4b753bc9cf5432
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Nov 10 10:21:08 2010 +0800

    gtklabel.c: Added hack for rint()

 gtk/gtklabel.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index f024b28..39655b8 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
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]