diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2012-04-05 22:55:15 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2012-05-03 11:59:16 +0800 |
commit | 5f61f40601dbce3597c40caddd9fd6c0415a47ad (patch) | |
tree | bdacf74ac89acc16a28d7b3f1ad8365f368e83d1 /gtk/fallback-c89.c | |
parent | a5626c489e7f6ea467b3bf665a928b4f9bfa88f1 (diff) | |
download | gtk+-5f61f40601dbce3597c40caddd9fd6c0415a47ad.tar.gz |
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.
Diffstat (limited to 'gtk/fallback-c89.c')
-rw-r--r-- | 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 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 |