Alexandre Julliard : ntdll: Move math functions to a separate file.
Alexandre Julliard
julliard at winehq.org
Tue Oct 26 16:19:19 CDT 2021
Module: wine
Branch: master
Commit: c7454eef0bf577545225c7c236a3f3b03daf31d3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c7454eef0bf577545225c7c236a3f3b03daf31d3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Oct 26 10:33:25 2021 +0200
ntdll: Move math functions to a separate file.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/Makefile.in | 1 +
dlls/ntdll/math.c | 177 +++++++++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/misc.c | 153 ------------------------------------------
3 files changed, 178 insertions(+), 153 deletions(-)
diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in
index aac7f8eead7..ba23e397545 100644
--- a/dlls/ntdll/Makefile.in
+++ b/dlls/ntdll/Makefile.in
@@ -22,6 +22,7 @@ C_SRCS = \
large_int.c \
loader.c \
locale.c \
+ math.c \
misc.c \
path.c \
printf.c \
diff --git a/dlls/ntdll/math.c b/dlls/ntdll/math.c
new file mode 100644
index 00000000000..8241e5077c2
--- /dev/null
+++ b/dlls/ntdll/math.c
@@ -0,0 +1,177 @@
+/*
+ * Math functions
+ *
+ * Copyright 2021 Alexandre Julliard
+ *
+ * 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 <math.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "ntdll_misc.h"
+
+/*********************************************************************
+ * abs (NTDLL.@)
+ */
+int CDECL abs( int i )
+{
+ return i >= 0 ? i : -i;
+}
+
+/*********************************************************************
+ * atan (NTDLL.@)
+ */
+double CDECL atan( double d )
+{
+ return unix_funcs->atan( d );
+}
+
+/*********************************************************************
+ * ceil (NTDLL.@)
+ */
+double CDECL ceil( double d )
+{
+ return unix_funcs->ceil( d );
+}
+
+/*********************************************************************
+ * cos (NTDLL.@)
+ */
+double CDECL cos( double d )
+{
+ return unix_funcs->cos( d );
+}
+
+/*********************************************************************
+ * fabs (NTDLL.@)
+ */
+double CDECL fabs( double d )
+{
+ return unix_funcs->fabs( d );
+}
+
+/*********************************************************************
+ * floor (NTDLL.@)
+ */
+double CDECL floor( double d )
+{
+ return unix_funcs->floor( d );
+}
+
+/*********************************************************************
+ * log (NTDLL.@)
+ */
+double CDECL log( double d )
+{
+ return unix_funcs->log( d );
+}
+
+/*********************************************************************
+ * pow (NTDLL.@)
+ */
+double CDECL pow( double x, double y )
+{
+ return unix_funcs->pow( x, y );
+}
+
+/*********************************************************************
+ * sin (NTDLL.@)
+ */
+double CDECL sin( double d )
+{
+ return unix_funcs->sin( d );
+}
+
+/*********************************************************************
+ * sqrt (NTDLL.@)
+ */
+double CDECL sqrt( double d )
+{
+ return unix_funcs->sqrt( d );
+}
+
+/*********************************************************************
+ * tan (NTDLL.@)
+ */
+double CDECL tan( double d )
+{
+ return unix_funcs->tan( d );
+}
+
+#if (defined(__GNUC__) || defined(__clang__)) && defined(__i386__)
+
+#define FPU_DOUBLE(var) double var; \
+ __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : )
+#define FPU_DOUBLES(var1,var2) double var1,var2; \
+ __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \
+ __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : )
+
+/*********************************************************************
+ * _CIcos (NTDLL.@)
+ */
+double CDECL _CIcos(void)
+{
+ FPU_DOUBLE(x);
+ return cos(x);
+}
+
+/*********************************************************************
+ * _CIlog (NTDLL.@)
+ */
+double CDECL _CIlog(void)
+{
+ FPU_DOUBLE(x);
+ return log(x);
+}
+
+/*********************************************************************
+ * _CIpow (NTDLL.@)
+ */
+double CDECL _CIpow(void)
+{
+ FPU_DOUBLES(x,y);
+ return pow(x,y);
+}
+
+/*********************************************************************
+ * _CIsin (NTDLL.@)
+ */
+double CDECL _CIsin(void)
+{
+ FPU_DOUBLE(x);
+ return sin(x);
+}
+
+/*********************************************************************
+ * _CIsqrt (NTDLL.@)
+ */
+double CDECL _CIsqrt(void)
+{
+ FPU_DOUBLE(x);
+ return sqrt(x);
+}
+
+/*********************************************************************
+ * _ftol (NTDLL.@)
+ */
+LONGLONG CDECL _ftol(void)
+{
+ FPU_DOUBLE(x);
+ return (LONGLONG)x;
+}
+
+#endif /* (defined(__GNUC__) || defined(__clang__)) && defined(__i386__) */
diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c
index 092900b289b..3bef5a561c8 100644
--- a/dlls/ntdll/misc.c
+++ b/dlls/ntdll/misc.c
@@ -20,7 +20,6 @@
*/
#include <time.h>
-#include <math.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
@@ -38,158 +37,6 @@ LPCSTR debugstr_us( const UNICODE_STRING *us )
return debugstr_wn(us->Buffer, us->Length / sizeof(WCHAR));
}
-/*********************************************************************
- * abs (NTDLL.@)
- */
-int CDECL abs( int i )
-{
- return i >= 0 ? i : -i;
-}
-
-/*********************************************************************
- * atan (NTDLL.@)
- */
-double CDECL atan( double d )
-{
- return unix_funcs->atan( d );
-}
-
-/*********************************************************************
- * ceil (NTDLL.@)
- */
-double CDECL ceil( double d )
-{
- return unix_funcs->ceil( d );
-}
-
-/*********************************************************************
- * cos (NTDLL.@)
- */
-double CDECL cos( double d )
-{
- return unix_funcs->cos( d );
-}
-
-/*********************************************************************
- * fabs (NTDLL.@)
- */
-double CDECL fabs( double d )
-{
- return unix_funcs->fabs( d );
-}
-
-/*********************************************************************
- * floor (NTDLL.@)
- */
-double CDECL floor( double d )
-{
- return unix_funcs->floor( d );
-}
-
-/*********************************************************************
- * log (NTDLL.@)
- */
-double CDECL log( double d )
-{
- return unix_funcs->log( d );
-}
-
-/*********************************************************************
- * pow (NTDLL.@)
- */
-double CDECL pow( double x, double y )
-{
- return unix_funcs->pow( x, y );
-}
-
-/*********************************************************************
- * sin (NTDLL.@)
- */
-double CDECL sin( double d )
-{
- return unix_funcs->sin( d );
-}
-
-/*********************************************************************
- * sqrt (NTDLL.@)
- */
-double CDECL sqrt( double d )
-{
- return unix_funcs->sqrt( d );
-}
-
-/*********************************************************************
- * tan (NTDLL.@)
- */
-double CDECL tan( double d )
-{
- return unix_funcs->tan( d );
-}
-
-#if (defined(__GNUC__) || defined(__clang__)) && defined(__i386__)
-
-#define FPU_DOUBLE(var) double var; \
- __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : )
-#define FPU_DOUBLES(var1,var2) double var1,var2; \
- __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \
- __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : )
-
-/*********************************************************************
- * _CIcos (NTDLL.@)
- */
-double CDECL _CIcos(void)
-{
- FPU_DOUBLE(x);
- return cos(x);
-}
-
-/*********************************************************************
- * _CIlog (NTDLL.@)
- */
-double CDECL _CIlog(void)
-{
- FPU_DOUBLE(x);
- return log(x);
-}
-
-/*********************************************************************
- * _CIpow (NTDLL.@)
- */
-double CDECL _CIpow(void)
-{
- FPU_DOUBLES(x,y);
- return pow(x,y);
-}
-
-/*********************************************************************
- * _CIsin (NTDLL.@)
- */
-double CDECL _CIsin(void)
-{
- FPU_DOUBLE(x);
- return sin(x);
-}
-
-/*********************************************************************
- * _CIsqrt (NTDLL.@)
- */
-double CDECL _CIsqrt(void)
-{
- FPU_DOUBLE(x);
- return sqrt(x);
-}
-
-/*********************************************************************
- * _ftol (NTDLL.@)
- */
-LONGLONG CDECL _ftol(void)
-{
- FPU_DOUBLE(x);
- return (LONGLONG)x;
-}
-
-#endif /* (defined(__GNUC__) || defined(__clang__)) && defined(__i386__) */
-
static void
NTDLL_mergesort( void *arr, void *barr, size_t elemsize, int(__cdecl *compar)(const void *, const void *),
size_t left, size_t right )
More information about the wine-cvs
mailing list