ntdll: Move the math functions to the Unix library.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-06-26 09:12:11 +02:00
parent fe4379eb19
commit e605919198
4 changed files with 48 additions and 21 deletions

View File

@ -77,15 +77,7 @@ void CDECL NTDLL_wine_get_host_version( const char **sysname, const char **relea
*/ */
int CDECL NTDLL_abs( int i ) int CDECL NTDLL_abs( int i )
{ {
return abs( i ); return i >= 0 ? i : -i;
}
/*********************************************************************
* labs (NTDLL.@)
*/
LONG CDECL NTDLL_labs( LONG i )
{
return labs( i );
} }
/********************************************************************* /*********************************************************************
@ -93,7 +85,7 @@ LONG CDECL NTDLL_labs( LONG i )
*/ */
double CDECL NTDLL_atan( double d ) double CDECL NTDLL_atan( double d )
{ {
return atan( d ); return unix_funcs->atan( d );
} }
/********************************************************************* /*********************************************************************
@ -101,7 +93,7 @@ double CDECL NTDLL_atan( double d )
*/ */
double CDECL NTDLL_ceil( double d ) double CDECL NTDLL_ceil( double d )
{ {
return ceil( d ); return unix_funcs->ceil( d );
} }
/********************************************************************* /*********************************************************************
@ -109,7 +101,7 @@ double CDECL NTDLL_ceil( double d )
*/ */
double CDECL NTDLL_cos( double d ) double CDECL NTDLL_cos( double d )
{ {
return cos( d ); return unix_funcs->cos( d );
} }
/********************************************************************* /*********************************************************************
@ -117,7 +109,7 @@ double CDECL NTDLL_cos( double d )
*/ */
double CDECL NTDLL_fabs( double d ) double CDECL NTDLL_fabs( double d )
{ {
return fabs( d ); return unix_funcs->fabs( d );
} }
/********************************************************************* /*********************************************************************
@ -125,7 +117,7 @@ double CDECL NTDLL_fabs( double d )
*/ */
double CDECL NTDLL_floor( double d ) double CDECL NTDLL_floor( double d )
{ {
return floor( d ); return unix_funcs->floor( d );
} }
/********************************************************************* /*********************************************************************
@ -133,7 +125,7 @@ double CDECL NTDLL_floor( double d )
*/ */
double CDECL NTDLL_log( double d ) double CDECL NTDLL_log( double d )
{ {
return log( d ); return unix_funcs->log( d );
} }
/********************************************************************* /*********************************************************************
@ -141,7 +133,7 @@ double CDECL NTDLL_log( double d )
*/ */
double CDECL NTDLL_pow( double x, double y ) double CDECL NTDLL_pow( double x, double y )
{ {
return pow( x, y ); return unix_funcs->pow( x, y );
} }
/********************************************************************* /*********************************************************************
@ -149,7 +141,7 @@ double CDECL NTDLL_pow( double x, double y )
*/ */
double CDECL NTDLL_sin( double d ) double CDECL NTDLL_sin( double d )
{ {
return sin( d ); return unix_funcs->sin( d );
} }
/********************************************************************* /*********************************************************************
@ -157,7 +149,7 @@ double CDECL NTDLL_sin( double d )
*/ */
double CDECL NTDLL_sqrt( double d ) double CDECL NTDLL_sqrt( double d )
{ {
return sqrt( d ); return unix_funcs->sqrt( d );
} }
/********************************************************************* /*********************************************************************
@ -165,7 +157,7 @@ double CDECL NTDLL_sqrt( double d )
*/ */
double CDECL NTDLL_tan( double d ) double CDECL NTDLL_tan( double d )
{ {
return tan( d ); return unix_funcs->tan( d );
} }
#if defined(__GNUC__) && defined(__i386__) #if defined(__GNUC__) && defined(__i386__)

View File

@ -1508,7 +1508,7 @@
@ cdecl iswspace(long) NTDLL_iswspace @ cdecl iswspace(long) NTDLL_iswspace
@ cdecl iswxdigit(long) NTDLL_iswxdigit @ cdecl iswxdigit(long) NTDLL_iswxdigit
@ cdecl isxdigit(long) NTDLL_isxdigit @ cdecl isxdigit(long) NTDLL_isxdigit
@ cdecl labs(long) NTDLL_labs @ cdecl labs(long) NTDLL_abs
@ cdecl log(double) NTDLL_log @ cdecl log(double) NTDLL_log
@ cdecl mbstowcs(ptr str long) NTDLL_mbstowcs @ cdecl mbstowcs(ptr str long) NTDLL_mbstowcs
@ cdecl memchr(ptr long long) NTDLL_memchr @ cdecl memchr(ptr long long) NTDLL_memchr

View File

@ -1331,6 +1331,19 @@ ULONG_PTR get_image_address(void)
} }
/* math function wrappers */
static double CDECL ntdll_atan( double d ) { return atan( d ); }
static double CDECL ntdll_ceil( double d ) { return ceil( d ); }
static double CDECL ntdll_cos( double d ) { return cos( d ); }
static double CDECL ntdll_fabs( double d ) { return fabs( d ); }
static double CDECL ntdll_floor( double d ) { return floor( d ); }
static double CDECL ntdll_log( double d ) { return log( d ); }
static double CDECL ntdll_pow( double x, double y ) { return pow( x, y ); }
static double CDECL ntdll_sin( double d ) { return sin( d ); }
static double CDECL ntdll_sqrt( double d ) { return sqrt( d ); }
static double CDECL ntdll_tan( double d ) { return tan( d ); }
/*********************************************************************** /***********************************************************************
* unix_funcs * unix_funcs
*/ */
@ -1466,6 +1479,16 @@ static struct unix_funcs unix_funcs =
fast_RtlSleepConditionVariableSRW, fast_RtlSleepConditionVariableSRW,
fast_RtlSleepConditionVariableCS, fast_RtlSleepConditionVariableCS,
fast_RtlWakeConditionVariable, fast_RtlWakeConditionVariable,
ntdll_atan,
ntdll_ceil,
ntdll_cos,
ntdll_fabs,
ntdll_floor,
ntdll_log,
ntdll_pow,
ntdll_sin,
ntdll_sqrt,
ntdll_tan,
get_initial_environment, get_initial_environment,
get_dynamic_environment, get_dynamic_environment,
get_initial_directory, get_initial_directory,

View File

@ -29,7 +29,7 @@ struct msghdr;
struct _DISPATCHER_CONTEXT; struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */ /* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 63 #define NTDLL_UNIXLIB_VERSION 64
struct unix_funcs struct unix_funcs
{ {
@ -285,6 +285,18 @@ struct unix_funcs
const LARGE_INTEGER *timeout ); const LARGE_INTEGER *timeout );
NTSTATUS (CDECL *fast_RtlWakeConditionVariable)( RTL_CONDITION_VARIABLE *variable, int count ); NTSTATUS (CDECL *fast_RtlWakeConditionVariable)( RTL_CONDITION_VARIABLE *variable, int count );
/* math functions */
double (CDECL *atan)( double d );
double (CDECL *ceil)( double d );
double (CDECL *cos)( double d );
double (CDECL *fabs)( double d );
double (CDECL *floor)( double d );
double (CDECL *log)( double d );
double (CDECL *pow)( double x, double y );
double (CDECL *sin)( double d );
double (CDECL *sqrt)( double d );
double (CDECL *tan)( double d );
/* environment functions */ /* environment functions */
NTSTATUS (CDECL *get_initial_environment)( WCHAR **wargv[], WCHAR *env, SIZE_T *size ); NTSTATUS (CDECL *get_initial_environment)( WCHAR **wargv[], WCHAR *env, SIZE_T *size );
NTSTATUS (CDECL *get_dynamic_environment)( WCHAR *env, SIZE_T *size ); NTSTATUS (CDECL *get_dynamic_environment)( WCHAR *env, SIZE_T *size );