From 3b1e2a7bfdb82c2e41cc96df4bb6ce5e1670b90e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 31 Mar 2023 15:38:53 +0200 Subject: [PATCH] msvcrt: Use the remainder()/remainderf() implementation from the bundled musl library. --- dlls/msvcr120/msvcr120.spec | 6 +++--- dlls/msvcrt/math.c | 24 +++++++++++------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 618fc3acbba..d4757be4a6f 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -2325,9 +2325,9 @@ @ cdecl rand() @ cdecl rand_s(ptr) @ cdecl realloc(ptr long) -@ cdecl remainder(double double) -@ cdecl remainderf(float float) -@ cdecl remainderl(double double) remainder +@ cdecl remainder(double double) MSVCRT_remainder +@ cdecl remainderf(float float) MSVCRT_remainderf +@ cdecl remainderl(double double) MSVCRT_remainder @ cdecl remove(str) @ cdecl remquo(double double ptr) @ cdecl remquof(float float ptr) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 2acfe23278d..5146ac43644 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -3350,36 +3350,34 @@ float CDECL _scalbf(float num, __msvcrt_long power) return ldexp(num, power); } -#if _MSVCR_VER>=120 +#if _MSVCR_VER == 120 /* other versions call remainder() directly */ /********************************************************************* * remainder (MSVCR120.@) - * - * Copied from musl: src/math/remainder.c */ -double CDECL remainder(double x, double y) +double CDECL MSVCRT_remainder(double x, double y) { - int q; -#if _MSVCR_VER == 120 && defined(__x86_64__) +#ifdef __x86_64__ if (isnan(x) || isnan(y)) *_errno() = EDOM; #endif - return remquo(x, y, &q); + return remainder(x, y); } /********************************************************************* * remainderf (MSVCR120.@) - * - * Copied from musl: src/math/remainderf.c */ -float CDECL remainderf(float x, float y) +float CDECL MSVCRT_remainderf(float x, float y) { - int q; -#if _MSVCR_VER == 120 && defined(__x86_64__) +#ifdef __x86_64__ if (isnan(x) || isnan(y)) *_errno() = EDOM; #endif - return remquof(x, y, &q); + return remainderf(x, y); } +#endif /* _MSVCR_VER == 120 */ + +#if _MSVCR_VER>=120 + /********************************************************************* * _except1 (MSVCR120.@) * TODO: