From b445b3da44d66704022012bc39f884b3ad0177b7 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 19 Dec 2014 19:44:03 -0800 Subject: Rename wsutil/floor.[ch] to wsutil/floorl.[ch]. That better indicates what they do - they don't supply floor(), as that's a standard math.h feature dating back before C89, they supply floorl(). Change-Id: Ib1278c51cdfc57680c28c51de87eafb2cb50c8eb Reviewed-on: https://code.wireshark.org/review/5905 Reviewed-by: Guy Harris --- wsutil/Makefile.am | 4 ++-- wsutil/floor.c | 47 ----------------------------------------------- wsutil/floor.h | 36 ------------------------------------ wsutil/floorl.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ wsutil/floorl.h | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 85 deletions(-) delete mode 100644 wsutil/floor.c delete mode 100644 wsutil/floor.h create mode 100644 wsutil/floorl.c create mode 100644 wsutil/floorl.h (limited to 'wsutil') diff --git a/wsutil/Makefile.am b/wsutil/Makefile.am index 99db32a887..8401e45b08 100644 --- a/wsutil/Makefile.am +++ b/wsutil/Makefile.am @@ -72,8 +72,8 @@ libwsutil_sse42_la_SOURCES = \ libwsutil_sse42_la_CFLAGS = $(AM_CFLAGS) @CFLAGS_SSE42@ EXTRA_libwsutil_la_SOURCES= \ - floor.c \ - floor.h \ + floorl.c \ + floorl.h \ inet_aton.c \ inet_aton.h \ inet_ntop.c \ diff --git a/wsutil/floor.c b/wsutil/floor.c deleted file mode 100644 index b2fa732e51..0000000000 --- a/wsutil/floor.c +++ /dev/null @@ -1,47 +0,0 @@ -/* floor.c - * - * Provides floor functions for systems that do not provide them - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" - -#include - -#ifndef HAVE_FLOORL -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 - /* Not perfect, but probably the best workaround available */ - return floor((double)x); -#endif -} - -#endif /* !HAVE_FLOORL */ diff --git a/wsutil/floor.h b/wsutil/floor.h deleted file mode 100644 index b73ddbc466..0000000000 --- a/wsutil/floor.h +++ /dev/null @@ -1,36 +0,0 @@ -/* floor.c - * - * Provides floor functions for systems that do not provide them - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __FLOORL_H__ -#define __FLOORL_H__ - -#include "config.h" - -#include "ws_symbol_export.h" - -/* - * Version of "floorl()", for the benefit of OSes that don't have it. - */ -WS_DLL_PUBLIC long double floorl(long double x); - -#endif /* __FLOORL_H__ */ diff --git a/wsutil/floorl.c b/wsutil/floorl.c new file mode 100644 index 0000000000..5ca7354441 --- /dev/null +++ b/wsutil/floorl.c @@ -0,0 +1,47 @@ +/* floorl.c + * + * Provides floorl function for systems that do not provide it + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include "wsutil/floorl.h" + +#ifndef HAVE_FLOORL +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 + /* Not perfect, but probably the best workaround available */ + return floor((double)x); +#endif +} + +#endif /* !HAVE_FLOORL */ diff --git a/wsutil/floorl.h b/wsutil/floorl.h new file mode 100644 index 0000000000..f83126e402 --- /dev/null +++ b/wsutil/floorl.h @@ -0,0 +1,36 @@ +/* floorl.h + * + * Declares floorl function for systems that do not provide it + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __FLOORL_H__ +#define __FLOORL_H__ + +#include "config.h" + +#include "ws_symbol_export.h" + +/* + * Version of "floorl()", for the benefit of OSes that don't have it. + */ +WS_DLL_PUBLIC long double floorl(long double x); + +#endif /* __FLOORL_H__ */ -- cgit v1.2.3