Commit 0b19a6f7 authored by Alexandre Julliard's avatar Alexandre Julliard

Better support for div and ldiv in Winelib apps.

parent ed36816b
...@@ -737,12 +737,10 @@ char *_gcvt( double number, int ndigit, char *buff ) ...@@ -737,12 +737,10 @@ char *_gcvt( double number, int ndigit, char *buff )
* [i386] Windows binary compatible - returns the struct in eax/edx. * [i386] Windows binary compatible - returns the struct in eax/edx.
*/ */
#ifdef __i386__ #ifdef __i386__
LONGLONG MSVCRT_div(int num, int denom) unsigned __int64 MSVCRT_div(int num, int denom)
{ {
LONGLONG retval;
div_t dt = div(num,denom); div_t dt = div(num,denom);
retval = ((LONGLONG)dt.rem << 32) | dt.quot; return ((unsigned __int64)dt.rem << 32) | (unsigned int)dt.quot;
return retval;
} }
#else #else
/********************************************************************* /*********************************************************************
...@@ -769,12 +767,10 @@ MSVCRT_div_t MSVCRT_div(int num, int denom) ...@@ -769,12 +767,10 @@ MSVCRT_div_t MSVCRT_div(int num, int denom)
* [i386] Windows binary compatible - returns the struct in eax/edx. * [i386] Windows binary compatible - returns the struct in eax/edx.
*/ */
#ifdef __i386__ #ifdef __i386__
ULONGLONG MSVCRT_ldiv(long num, long denom) unsigned __int64 MSVCRT_ldiv(long num, long denom)
{ {
ULONGLONG retval;
ldiv_t ldt = ldiv(num,denom); ldiv_t ldt = ldiv(num,denom);
retval = ((ULONGLONG)ldt.rem << 32) | (ULONG)ldt.quot; return ((unsigned __int64)ldt.rem << 32) | (unsigned long)ldt.quot;
return retval;
} }
#else #else
/********************************************************************* /*********************************************************************
......
...@@ -170,10 +170,7 @@ double MSVCRT(atof)(const char*); ...@@ -170,10 +170,7 @@ double MSVCRT(atof)(const char*);
int MSVCRT(atoi)(const char*); int MSVCRT(atoi)(const char*);
long MSVCRT(atol)(const char*); long MSVCRT(atol)(const char*);
void* MSVCRT(calloc)(MSVCRT(size_t),MSVCRT(size_t)); void* MSVCRT(calloc)(MSVCRT(size_t),MSVCRT(size_t));
#ifdef __i386__ #ifndef __i386__
__int64 MSVCRT(div)(int,int);
unsigned __int64 MSVCRT(ldiv)(long,long);
#else
MSVCRT(div_t) MSVCRT(div)(int,int); MSVCRT(div_t) MSVCRT(div)(int,int);
MSVCRT(ldiv_t) MSVCRT(ldiv)(long,long); MSVCRT(ldiv_t) MSVCRT(ldiv)(long,long);
#endif #endif
...@@ -242,6 +239,30 @@ static inline _onexit_t onexit(_onexit_t func) { return _onexit(func); } ...@@ -242,6 +239,30 @@ static inline _onexit_t onexit(_onexit_t func) { return _onexit(func); }
static inline int putenv(const char* str) { return _putenv(str); } static inline int putenv(const char* str) { return _putenv(str); }
static inline void swab(char* src, char* dst, int len) { _swab(src, dst, len); } static inline void swab(char* src, char* dst, int len) { _swab(src, dst, len); }
static inline char* ultoa(unsigned long value, char* str, int radix) { return _ultoa(value, str, radix); } static inline char* ultoa(unsigned long value, char* str, int radix) { return _ultoa(value, str, radix); }
#ifdef __i386__
static inline div_t __wine_msvcrt_div(int num, int denom)
{
extern unsigned __int64 div(int,int);
div_t ret;
unsigned __int64 res = div(num,denom);
ret.quot = (int)res;
ret.rem = (int)(res >> 32);
return ret;
}
static inline ldiv_t __wine_msvcrt_ldiv(long num, long denom)
{
extern unsigned __int64 ldiv(long,long);
ldiv_t ret;
unsigned __int64 res = ldiv(num,denom);
ret.quot = (long)res;
ret.rem = (long)(res >> 32);
return ret;
}
#define div(num,denom) __wine_msvcrt_div(num,denom)
#define ldiv(num,denom) __wine_msvcrt_ldiv(num,denom)
#endif
#endif /* USE_MSVCRT_PREFIX */ #endif /* USE_MSVCRT_PREFIX */
#endif /* __WINE_STDLIB_H */ #endif /* __WINE_STDLIB_H */
...@@ -80,14 +80,12 @@ static const char * const default_ignored_symbols[] = ...@@ -80,14 +80,12 @@ static const char * const default_ignored_symbols[] =
"ceil", "ceil",
"cos", "cos",
"cosh", "cosh",
"div",
"exp", "exp",
"fabs", "fabs",
"floor", "floor",
"fmod", "fmod",
"frexp", "frexp",
"labs", "labs",
"ldiv",
"log", "log",
"log10", "log10",
"memchr", "memchr",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment