Alexandre Julliard : ntdll: Copy some missing math functions from msvcrt.

Alexandre Julliard julliard at winehq.org
Thu Mar 14 14:55:06 CDT 2013


Module: wine
Branch: master
Commit: 17be935568ed630f4a7a53c345dbe533ee61b1ed
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=17be935568ed630f4a7a53c345dbe533ee61b1ed

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Mar 14 13:43:46 2013 +0100

ntdll: Copy some missing math functions from msvcrt.

---

 dlls/ntdll/misc.c     |  129 ++++++++++++++++++++++++-------------------------
 dlls/ntdll/ntdll.spec |    8 ++--
 2 files changed, 67 insertions(+), 70 deletions(-)

diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c
index fecd67e..c115c9c 100644
--- a/dlls/ntdll/misc.c
+++ b/dlls/ntdll/misc.c
@@ -53,72 +53,6 @@ LPCSTR debugstr_us( const UNICODE_STRING *us )
 }
 
 /*********************************************************************
- *                  _ftol   (NTDLL.@)
- *
- * VERSION
- *	[GNUC && i386]
- */
-#if defined(__GNUC__) && defined(__i386__)
-LONGLONG CDECL NTDLL__ftol(void)
-{
-	/* don't just do DO_FPU("fistp",retval), because the rounding
-	 * mode must also be set to "round towards zero"... */
-	double fl;
-	POP_FPU(fl);
-	return (LONGLONG)fl;
-}
-#endif /* defined(__GNUC__) && defined(__i386__) */
-
-/*********************************************************************
- *                  _ftol   (NTDLL.@)
- *
- * FIXME
- *	Should be register function
- * VERSION
- *	[!GNUC && i386]
- */
-#if !defined(__GNUC__) && defined(__i386__)
-LONGLONG CDECL NTDLL__ftol(double fl)
-{
-	FIXME("should be register function\n");
-	return (LONGLONG)fl;
-}
-#endif /* !defined(__GNUC__) && defined(__i386__) */
-
-/*********************************************************************
- *                  _CIpow   (NTDLL.@)
- * VERSION
- *	[GNUC && i386]
- */
-#if defined(__GNUC__) && defined(__i386__)
-double CDECL NTDLL__CIpow(void)
-{
-	double x,y;
-	POP_FPU(y);
-	POP_FPU(x);
-	return pow(x,y);
-}
-#endif /* defined(__GNUC__) && defined(__i386__) */
-
-
-/*********************************************************************
- *                  _CIpow   (NTDLL.@)
- *
- * FIXME
- *	Should be register function
- *
- * VERSION
- *	[!GNUC && i386]
- */
-#if !defined(__GNUC__) && defined(__i386__)
-double CDECL NTDLL__CIpow(double x,double y)
-{
-	FIXME("should be register function\n");
-	return pow(x,y);
-}
-#endif /* !defined(__GNUC__) && defined(__i386__) */
-
-/*********************************************************************
  *                  wine_get_version   (NTDLL.@)
  */
 const char * CDECL NTDLL_wine_get_version(void)
@@ -252,6 +186,69 @@ double CDECL NTDLL_tan( double d )
     return tan( d );
 }
 
+#if defined(__GNUC__) && 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 NTDLL__CIcos(void)
+{
+    FPU_DOUBLE(x);
+    return NTDLL_cos(x);
+}
+
+/*********************************************************************
+ *		_CIlog (NTDLL.@)
+ */
+double CDECL NTDLL__CIlog(void)
+{
+    FPU_DOUBLE(x);
+    return NTDLL_log(x);
+}
+
+/*********************************************************************
+ *		_CIpow (NTDLL.@)
+ */
+double CDECL NTDLL__CIpow(void)
+{
+    FPU_DOUBLES(x,y);
+    return NTDLL_pow(x,y);
+}
+
+/*********************************************************************
+ *		_CIsin (NTDLL.@)
+ */
+double CDECL NTDLL__CIsin(void)
+{
+    FPU_DOUBLE(x);
+    return NTDLL_sin(x);
+}
+
+/*********************************************************************
+ *		_CIsqrt (NTDLL.@)
+ */
+double CDECL NTDLL__CIsqrt(void)
+{
+    FPU_DOUBLE(x);
+    return NTDLL_sqrt(x);
+}
+
+/*********************************************************************
+ *                  _ftol   (NTDLL.@)
+ */
+LONGLONG CDECL NTDLL__ftol(void)
+{
+    FPU_DOUBLE(x);
+    return (LONGLONG)x;
+}
+
+#endif /* defined(__GNUC__) && defined(__i386__) */
 
 static void
 NTDLL_mergesort( void *arr, void *barr, size_t elemsize, int(__cdecl *compar)(const void *, const void *),
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 19ff8e4..d144986 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1240,11 +1240,11 @@
 @ stub ZwWriteRequestData
 @ stdcall ZwWriteVirtualMemory(long ptr ptr long ptr) NtWriteVirtualMemory
 @ stdcall ZwYieldExecution() NtYieldExecution
-# @ stub _CIcos
-# @ stub _CIlog
+@ cdecl -private -arch=i386 _CIcos() NTDLL__CIcos
+@ cdecl -private -arch=i386 _CIlog() NTDLL__CIlog
 @ cdecl -private -arch=i386 _CIpow() NTDLL__CIpow
-# @ stub _CIsin
-# @ stub _CIsqrt
+@ cdecl -private -arch=i386 _CIsin() NTDLL__CIsin
+@ cdecl -private -arch=i386 _CIsqrt() NTDLL__CIsqrt
 @ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr)
 @ stdcall -private -arch=x86_64 -norelay __chkstk()
 # @ stub __isascii




More information about the wine-cvs mailing list