mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
msvcrt: sizeof(long double) is 12 with MS, but not necessarily so on UNIX.
This commit is contained in:
parent
4dc81b6518
commit
c6d67fad8f
2 changed files with 16 additions and 6 deletions
|
@ -86,7 +86,7 @@ typedef int (*__cdecl MSVCRT__onexit_t)(void);
|
|||
typedef void (__cdecl *MSVCRT_invalid_parameter_handler)(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, unsigned, MSVCRT_uintptr_t);
|
||||
typedef void (__cdecl *MSVCRT_purecall_handler)(void);
|
||||
|
||||
typedef struct {long double x;} MSVCRT__LDOUBLE;
|
||||
typedef struct {ULONG x80[3];} MSVCRT__LDOUBLE; /* Intel 80 bit FP format has sizeof() 12 */
|
||||
|
||||
struct MSVCRT_tm {
|
||||
int tm_sec;
|
||||
|
|
|
@ -561,8 +561,10 @@ int CDECL MSVCRT__atoldbl(MSVCRT__LDOUBLE *value, const char *str)
|
|||
{
|
||||
/* FIXME needs error checking for huge/small values */
|
||||
#ifdef HAVE_STRTOLD
|
||||
long double ld;
|
||||
TRACE("str %s value %p\n",str,value);
|
||||
value->x = strtold(str,0);
|
||||
ld = strtold(str,0);
|
||||
memcpy(value, &ld, 10);
|
||||
#else
|
||||
FIXME("stub, str %s value %p\n",str,value);
|
||||
#endif
|
||||
|
@ -575,8 +577,10 @@ int CDECL MSVCRT__atoldbl(MSVCRT__LDOUBLE *value, const char *str)
|
|||
int CDECL __STRINGTOLD( MSVCRT__LDOUBLE *value, char **endptr, const char *str, int flags )
|
||||
{
|
||||
#ifdef HAVE_STRTOLD
|
||||
long double ld;
|
||||
FIXME("%p %p %s %x partial stub\n", value, endptr, str, flags );
|
||||
value->x = strtold(str,endptr);
|
||||
ld = strtold(str,0);
|
||||
memcpy(value, &ld, 10);
|
||||
#else
|
||||
FIXME("%p %p %s %x stub\n", value, endptr, str, flags );
|
||||
#endif
|
||||
|
@ -1281,7 +1285,7 @@ struct _I10_OUTPUT_DATA {
|
|||
|
||||
/*********************************************************************
|
||||
* $I10_OUTPUT (MSVCRT.@)
|
||||
* ld - long double to be printed to data
|
||||
* ld80 - long double (Intel 80 bit FP in 12 bytes) to be printed to data
|
||||
* prec - precision of part, we're interested in
|
||||
* flag - 0 for first prec digits, 1 for fractional part
|
||||
* data - data to be populated
|
||||
|
@ -1294,16 +1298,22 @@ struct _I10_OUTPUT_DATA {
|
|||
* Native sets last byte of data->str to '0' or '9', I don't know what
|
||||
* it means. Current implementation sets it always to '0'.
|
||||
*/
|
||||
int CDECL MSVCRT_I10_OUTPUT(MSVCRT__LDOUBLE ld, int prec, int flag, struct _I10_OUTPUT_DATA *data)
|
||||
int CDECL MSVCRT_I10_OUTPUT(MSVCRT__LDOUBLE ld80, int prec, int flag, struct _I10_OUTPUT_DATA *data)
|
||||
{
|
||||
static const char inf_str[] = "1#INF";
|
||||
static const char nan_str[] = "1#QNAN";
|
||||
|
||||
double d = ld.x;
|
||||
/* MS' long double type wants 12 bytes for Intel's 80 bit FP format.
|
||||
* Some UNIX have sizeof(long double) == 16, yet only 80 bit are used.
|
||||
* Assume long double uses 80 bit FP, never seen 128 bit FP. */
|
||||
long double ld = 0;
|
||||
double d;
|
||||
char format[8];
|
||||
char buf[I10_OUTPUT_MAX_PREC+9]; /* 9 = strlen("0.e+0000") + '\0' */
|
||||
char *p;
|
||||
|
||||
memcpy(&ld, &ld80, 10);
|
||||
d = ld;
|
||||
TRACE("(%lf %d %x %p)\n", d, prec, flag, data);
|
||||
|
||||
if(d<0) {
|
||||
|
|
Loading…
Reference in a new issue