[gtk+/gtk-3-4] Bug 670499-gtk/fallback-c89.c: Add fallback for nearbyint()
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-4] Bug 670499-gtk/fallback-c89.c: Add fallback for nearbyint()
- Date: Thu, 3 May 2012 04:03:04 +0000 (UTC)
commit 8813a71b369023282b8a7c27ae429e9691a75da4
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Apr 5 22:55:15 2012 +0800
Bug 670499-gtk/fallback-c89.c: Add fallback for nearbyint()
This adds a C89 implementation for nearbyint() as it is a function that
is only made available in C99.
gtk/fallback-c89.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtk/fallback-c89.c b/gtk/fallback-c89.c
index eb713b8..aaccd9d 100644
--- a/gtk/fallback-c89.c
+++ b/gtk/fallback-c89.c
@@ -53,4 +53,15 @@ rint (double x)
return ceil (x - 0.5);
}
}
-#endif
\ No newline at end of file
+#endif
+
+#ifndef HAVE_NEARBYINT
+/* Workaround for nearbyint() for non-GCC/non-C99 compilers */
+/* This is quite similar to rint() in most respects */
+
+static inline double
+nearbyint (double x)
+{
+ return floor (x + 0.5);
+}
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]