libport: Remove the rint() function replacements.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-12-01 10:15:49 +01:00
parent 8a75411ec5
commit 335b05ac90
4 changed files with 24 additions and 91 deletions

View File

@ -479,7 +479,11 @@ static float CDECL unix_lgammaf(float x)
*/
static __int64 CDECL unix_llrint(double x)
{
#ifdef HAVE_LLRINT
return llrint(x);
#else
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
#endif
}
/*********************************************************************
@ -487,7 +491,11 @@ static __int64 CDECL unix_llrint(double x)
*/
static __int64 CDECL unix_llrintf(float x)
{
#ifdef HAVE_LLRINTF
return llrintf(x);
#else
return x >= 0 ? floorf(x + 0.5) : ceilf(x - 0.5);
#endif
}
/*********************************************************************
@ -591,7 +599,11 @@ static float CDECL unix_logbf( float x )
*/
static int CDECL unix_lrint(double x)
{
#ifdef HAVE_LRINT
return lrint(x);
#else
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
#endif
}
/*********************************************************************
@ -599,7 +611,11 @@ static int CDECL unix_lrint(double x)
*/
static int CDECL unix_lrintf(float x)
{
#ifdef HAVE_LRINTF
return lrintf(x);
#else
return x >= 0 ? floorf(x + 0.5) : ceilf(x - 0.5);
#endif
}
/*********************************************************************
@ -757,7 +773,11 @@ static float CDECL unix_remquof(float x, float y, int *quo)
*/
static double CDECL unix_rint(double x)
{
#ifdef HAVE_RINT
return rint(x);
#else
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
#endif
}
/*********************************************************************
@ -765,7 +785,11 @@ static double CDECL unix_rint(double x)
*/
static float CDECL unix_rintf(float x)
{
#ifdef HAVE_RINTF
return rintf(x);
#else
return x >= 0 ? floorf(x + 0.5) : ceilf(x - 0.5);
#endif
}
/*********************************************************************

View File

@ -278,22 +278,6 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
int ffs( int x );
#endif
#ifndef HAVE_LLRINT
__int64 llrint(double x);
#endif
#ifndef HAVE_LLRINTF
__int64 llrintf(float x);
#endif
#ifndef HAVE_LRINT
long lrint(double x);
#endif
#ifndef HAVE_LRINTF
long lrintf(float x);
#endif
#ifndef HAVE_LSTAT
int lstat(const char *file_name, struct stat *buf);
#endif /* HAVE_LSTAT */
@ -326,14 +310,6 @@ ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
int readlink( const char *path, char *buf, size_t size );
#endif /* HAVE_READLINK */
#ifndef HAVE_RINT
double rint(double x);
#endif
#ifndef HAVE_RINTF
float rintf(float x);
#endif
#ifndef HAVE_STATVFS
int statvfs( const char *path, struct statvfs *buf );
#endif

View File

@ -13,7 +13,6 @@ C_SRCS = \
pread.c \
pwrite.c \
readlink.c \
rint.c \
spawn.c \
statvfs.c \
strnlen.c \

View File

@ -1,66 +0,0 @@
/*
* rint family
*
* Copyright 2017 Alex Henrie
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.h>
#ifndef HAVE_RINT
double rint(double x)
{
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
}
#endif
#ifndef HAVE_RINTF
float rintf(float x)
{
return rint(x);
}
#endif
#ifndef HAVE_LRINT
long lrint(double x)
{
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
}
#endif
#ifndef HAVE_LRINTF
long lrintf(float x)
{
return lrint(x);
}
#endif
#ifndef HAVE_LLRINT
__int64 llrint(double x)
{
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
}
#endif
#ifndef HAVE_LLRINTF
__int64 llrintf(float x)
{
return llrint(x);
}
#endif