If we don't have GCC, fall back on using floor().

Add the closing brace for the function body while we're at it.

Change-Id: I73170fdc0885972dce531b553ff8601cceea182e
Reviewed-on: https://code.wireshark.org/review/5902
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-12-19 18:59:55 -08:00
parent b736896490
commit 1088629503
1 changed files with 10 additions and 2 deletions

View File

@ -30,10 +30,18 @@ long double
floorl(long double x)
{
#ifdef (__GNUC__)
/*
* Handle platforms where GCC has the builtin but the platform's
* headers (including the headers used with GCC!) don't define
* floorl() to use it.
*
* XXX - are there any such platforms?
*/
__builtin_floorl(x);
#else
#error "The floorl() function is not present on this system and the GNU C"
#error "compiler (gcc) isn't in use, which can provide one."
/* Not perfect, but probably the best workaround available */
return floor((double)x);
#endif
}
#endif /* !HAVE_FLOORL */