libport: Move rint fallback implementations from msvcrt to libport.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6bae0a003e
commit
06d9c7e25e
|
@ -35,6 +35,7 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
|
|
|
@ -2604,11 +2604,7 @@ LDOUBLE CDECL MSVCR120_log2l(LDOUBLE x)
|
|||
*/
|
||||
double CDECL MSVCR120_rint(double x)
|
||||
{
|
||||
#ifdef HAVE_RINT
|
||||
return rint(x);
|
||||
#else
|
||||
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -2616,11 +2612,7 @@ double CDECL MSVCR120_rint(double x)
|
|||
*/
|
||||
float CDECL MSVCR120_rintf(float x)
|
||||
{
|
||||
#ifdef HAVE_RINTF
|
||||
return rintf(x);
|
||||
#else
|
||||
return MSVCR120_rint(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -2636,11 +2628,7 @@ LDOUBLE CDECL MSVCR120_rintl(LDOUBLE x)
|
|||
*/
|
||||
MSVCRT_long CDECL MSVCR120_lrint(double x)
|
||||
{
|
||||
#ifdef HAVE_LRINT
|
||||
return lrint(x);
|
||||
#else
|
||||
return MSVCR120_rint(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -2648,11 +2636,7 @@ MSVCRT_long CDECL MSVCR120_lrint(double x)
|
|||
*/
|
||||
MSVCRT_long CDECL MSVCR120_lrintf(float x)
|
||||
{
|
||||
#ifdef HAVE_LRINTF
|
||||
return lrintf(x);
|
||||
#else
|
||||
return MSVCR120_lrint(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -2668,11 +2652,7 @@ MSVCRT_long CDECL MSVCR120_lrintl(LDOUBLE x)
|
|||
*/
|
||||
MSVCRT_longlong CDECL MSVCR120_llrint(double x)
|
||||
{
|
||||
#ifdef HAVE_LLRINT
|
||||
return llrint(x);
|
||||
#else
|
||||
return MSVCR120_rint(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -2680,11 +2660,7 @@ MSVCRT_longlong CDECL MSVCR120_llrint(double x)
|
|||
*/
|
||||
MSVCRT_longlong CDECL MSVCR120_llrintf(float x)
|
||||
{
|
||||
#ifdef HAVE_LLRINTF
|
||||
return llrintf(x);
|
||||
#else
|
||||
return MSVCR120_llrint(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
|
@ -272,6 +272,22 @@ int isinf(double x);
|
|||
int isnan(double 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 */
|
||||
|
@ -308,6 +324,14 @@ 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
|
||||
|
|
|
@ -96,6 +96,7 @@ C_SRCS = \
|
|||
pread.c \
|
||||
pwrite.c \
|
||||
readlink.c \
|
||||
rint.c \
|
||||
spawn.c \
|
||||
statvfs.c \
|
||||
strcasecmp.c \
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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 rintf(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
|
Loading…
Reference in New Issue