Alexandre Julliard : libport: Remove the rint() function replacements.

Alexandre Julliard julliard at winehq.org
Tue Dec 1 15:40:33 CST 2020


Module: wine
Branch: master
Commit: 335b05ac90cd2349b99e7547acd7c1df89650c57
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=335b05ac90cd2349b99e7547acd7c1df89650c57

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec  1 10:15:49 2020 +0100

libport: Remove the rint() function replacements.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/unixlib.c | 24 +++++++++++++++++++
 include/wine/port.h   | 24 -------------------
 libs/port/Makefile.in |  1 -
 libs/port/rint.c      | 66 ---------------------------------------------------
 4 files changed, 24 insertions(+), 91 deletions(-)

diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c
index 3913d61048a..b08663f387a 100644
--- a/dlls/msvcrt/unixlib.c
+++ b/dlls/msvcrt/unixlib.c
@@ -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
 }
 
 /*********************************************************************
diff --git a/include/wine/port.h b/include/wine/port.h
index 928730a41d7..993cf483c15 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -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
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index 51cfdb4df54..435598c2856 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -13,7 +13,6 @@ C_SRCS = \
 	pread.c \
 	pwrite.c \
 	readlink.c \
-	rint.c \
 	spawn.c \
 	statvfs.c \
 	strnlen.c \
diff --git a/libs/port/rint.c b/libs/port/rint.c
deleted file mode 100644
index 2c0d22294c2..00000000000
--- a/libs/port/rint.c
+++ /dev/null
@@ -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




More information about the wine-cvs mailing list