Piotr Caban : msvcrt: Implement llrint using rint function.

Alexandre Julliard julliard at winehq.org
Mon May 10 15:44:05 CDT 2021


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon May 10 20:11:59 2021 +0200

msvcrt: Implement llrint using rint function.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure             |  1 -
 configure.ac          |  1 -
 dlls/msvcrt/math.c    | 10 +++++++++-
 dlls/msvcrt/unixlib.c | 13 -------------
 dlls/msvcrt/unixlib.h |  1 -
 include/config.h.in   |  3 ---
 6 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/configure b/configure
index b4434b16a86..d4f1cf1383c 100755
--- a/configure
+++ b/configure
@@ -19636,7 +19636,6 @@ for ac_func in \
 	fmaf \
 	lgamma \
 	lgammaf \
-	llrint \
 	llrintf \
 	log1p \
 	log1pf \
diff --git a/configure.ac b/configure.ac
index 2cd25a5671b..8fa4eac0961 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2676,7 +2676,6 @@ AC_CHECK_FUNCS(\
 	fmaf \
 	lgamma \
 	lgammaf \
-	llrint \
 	llrintf \
 	log1p \
 	log1pf \
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 22b2b0c71ed..b9209e7b349 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -4372,7 +4372,15 @@ __msvcrt_long CDECL lrintf(float x)
  */
 __int64 CDECL llrint(double x)
 {
-    return unix_funcs->llrint( x );
+    double d;
+
+    d = rint(x);
+    if ((d < 0 && d != (double)(__int64)d)
+            || (d >= 0 && d != (double)(unsigned __int64)d)) {
+        *_errno() = EDOM;
+        return 0;
+    }
+    return d;
 }
 
 /*********************************************************************
diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c
index 52410b0cc9c..a7a69405877 100644
--- a/dlls/msvcrt/unixlib.c
+++ b/dlls/msvcrt/unixlib.c
@@ -435,18 +435,6 @@ static float CDECL unix_lgammaf(float x)
 #endif
 }
 
-/*********************************************************************
- *      llrint
- */
-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
-}
-
 /*********************************************************************
  *      llrintf
  */
@@ -858,7 +846,6 @@ static const struct unix_funcs funcs =
     unix_ldexp,
     unix_lgamma,
     unix_lgammaf,
-    unix_llrint,
     unix_llrintf,
     unix_log,
     unix_logf,
diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h
index 4a33940fd64..56e8d630dc2 100644
--- a/dlls/msvcrt/unixlib.h
+++ b/dlls/msvcrt/unixlib.h
@@ -60,7 +60,6 @@ struct unix_funcs
     double          (CDECL *ldexp)(double x, int exp);
     double          (CDECL *lgamma)(double x);
     float           (CDECL *lgammaf)(float x);
-    __int64         (CDECL *llrint)(double x);
     __int64         (CDECL *llrintf)(float x);
     double          (CDECL *log)(double x);
     float           (CDECL *logf)(float x);
diff --git a/include/config.h.in b/include/config.h.in
index 920600dd680..db5dba7a54f 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -453,9 +453,6 @@
 /* Define to 1 if you have the <linux/videodev2.h> header file. */
 #undef HAVE_LINUX_VIDEODEV2_H
 
-/* Define to 1 if you have the `llrint' function. */
-#undef HAVE_LLRINT
-
 /* Define to 1 if you have the `llrintf' function. */
 #undef HAVE_LLRINTF
 




More information about the wine-cvs mailing list