Commit 335b05ac authored by Alexandre Julliard's avatar Alexandre Julliard

libport: Remove the rint() function replacements.

parent 8a75411e
...@@ -479,7 +479,11 @@ static float CDECL unix_lgammaf(float x) ...@@ -479,7 +479,11 @@ static float CDECL unix_lgammaf(float x)
*/ */
static __int64 CDECL unix_llrint(double x) static __int64 CDECL unix_llrint(double x)
{ {
#ifdef HAVE_LLRINT
return llrint(x); 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) ...@@ -487,7 +491,11 @@ static __int64 CDECL unix_llrint(double x)
*/ */
static __int64 CDECL unix_llrintf(float x) static __int64 CDECL unix_llrintf(float x)
{ {
#ifdef HAVE_LLRINTF
return llrintf(x); 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 ) ...@@ -591,7 +599,11 @@ static float CDECL unix_logbf( float x )
*/ */
static int CDECL unix_lrint(double x) static int CDECL unix_lrint(double x)
{ {
#ifdef HAVE_LRINT
return lrint(x); 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) ...@@ -599,7 +611,11 @@ static int CDECL unix_lrint(double x)
*/ */
static int CDECL unix_lrintf(float x) static int CDECL unix_lrintf(float x)
{ {
#ifdef HAVE_LRINTF
return lrintf(x); 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) ...@@ -757,7 +773,11 @@ static float CDECL unix_remquof(float x, float y, int *quo)
*/ */
static double CDECL unix_rint(double x) static double CDECL unix_rint(double x)
{ {
#ifdef HAVE_RINT
return rint(x); 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) ...@@ -765,7 +785,11 @@ static double CDECL unix_rint(double x)
*/ */
static float CDECL unix_rintf(float x) static float CDECL unix_rintf(float x)
{ {
#ifdef HAVE_RINTF
return rintf(x); return rintf(x);
#else
return x >= 0 ? floorf(x + 0.5) : ceilf(x - 0.5);
#endif
} }
/********************************************************************* /*********************************************************************
......
...@@ -278,22 +278,6 @@ extern int getopt_long_only (int ___argc, char *const *___argv, ...@@ -278,22 +278,6 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
int ffs( int x ); int ffs( int x );
#endif #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 #ifndef HAVE_LSTAT
int lstat(const char *file_name, struct stat *buf); int lstat(const char *file_name, struct stat *buf);
#endif /* HAVE_LSTAT */ #endif /* HAVE_LSTAT */
...@@ -326,14 +310,6 @@ ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset ); ...@@ -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 ); int readlink( const char *path, char *buf, size_t size );
#endif /* HAVE_READLINK */ #endif /* HAVE_READLINK */
#ifndef HAVE_RINT
double rint(double x);
#endif
#ifndef HAVE_RINTF
float rintf(float x);
#endif
#ifndef HAVE_STATVFS #ifndef HAVE_STATVFS
int statvfs( const char *path, struct statvfs *buf ); int statvfs( const char *path, struct statvfs *buf );
#endif #endif
......
...@@ -13,7 +13,6 @@ C_SRCS = \ ...@@ -13,7 +13,6 @@ C_SRCS = \
pread.c \ pread.c \
pwrite.c \ pwrite.c \
readlink.c \ readlink.c \
rint.c \
spawn.c \ spawn.c \
statvfs.c \ statvfs.c \
strnlen.c \ strnlen.c \
......
/*
* 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment