From 5f61f40601dbce3597c40caddd9fd6c0415a47ad Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 5 Apr 2012 22:55:15 +0800 Subject: [PATCH] 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 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gtk/fallback-c89.c b/gtk/fallback-c89.c index eb713b8b35..aaccd9d0ce 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