Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aleksandr Isakov
wine-fonts
Commits
35c09b52
Commit
35c09b52
authored
Jan 27, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Set and restore the full floating point control word.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7c6fbebf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
26 deletions
+60
-26
reader.c
dlls/webservices/reader.c
+9
-22
writer.c
dlls/webservices/tests/writer.c
+47
-0
webservices_private.h
dlls/webservices/webservices_private.h
+2
-2
writer.c
dlls/webservices/writer.c
+2
-2
No files found.
dlls/webservices/reader.c
View file @
35c09b52
...
...
@@ -2294,17 +2294,14 @@ static HRESULT str_to_uint64( const unsigned char *str, ULONG len, UINT64 max, U
return
S_OK
;
}
#if defined(__i386__) || defined(__x86_64__)
#define RC_DOWN 0x100;
BOOL
set_fp_rounding
(
unsigned
short
*
save
)
BOOL
set_fpword
(
unsigned
short
new
,
unsigned
short
*
old
)
{
#if
def __GNUC__
#if
defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
unsigned
short
fpword
;
__asm__
__volatile__
(
"fstcw %0"
:
"=m"
(
fpword
)
);
*
save
=
fpword
;
fpword
|=
RC_DOWN
;
*
old
=
fpword
;
fpword
=
new
;
__asm__
__volatile__
(
"fldcw %0"
:
:
"m"
(
fpword
)
);
return
TRUE
;
#else
...
...
@@ -2312,25 +2309,15 @@ BOOL set_fp_rounding( unsigned short *save )
return
FALSE
;
#endif
}
void
restore_fp_rounding
(
unsigned
short
fpword
)
void
restore_fpword
(
unsigned
short
fpword
)
{
#if
def __GNUC__
#if
defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
__asm__
__volatile__
(
"fldcw %0"
:
:
"m"
(
fpword
)
);
#else
FIXME
(
"not implemented
\n
"
);
#endif
}
#else
BOOL
set_fp_rounding
(
unsigned
short
*
save
)
{
FIXME
(
"not implemented
\n
"
);
return
FALSE
;
}
void
restore_fp_rounding
(
unsigned
short
fpword
)
{
FIXME
(
"not implemented
\n
"
);
}
#endif
static
HRESULT
str_to_double
(
const
unsigned
char
*
str
,
ULONG
len
,
double
*
ret
)
{
...
...
@@ -2373,7 +2360,7 @@ static HRESULT str_to_double( const unsigned char *str, ULONG len, double *ret )
else
if
(
*
p
==
'+'
)
{
p
++
;
len
--
;
};
if
(
!
len
)
return
S_OK
;
if
(
!
set_fp
_rounding
(
&
fpword
))
return
E_NOTIMPL
;
if
(
!
set_fp
word
(
0x37f
,
&
fpword
))
return
E_NOTIMPL
;
q
=
p
;
while
(
len
&&
isdigit
(
*
q
))
{
q
++
;
len
--
;
}
...
...
@@ -2444,7 +2431,7 @@ static HRESULT str_to_double( const unsigned char *str, ULONG len, double *ret )
hr
=
S_OK
;
done:
restore_fp
_rounding
(
fpword
);
restore_fp
word
(
fpword
);
return
hr
;
}
...
...
dlls/webservices/tests/writer.c
View file @
35c09b52
...
...
@@ -2065,9 +2065,28 @@ static void test_text_types(void)
WsFreeWriter
(
writer
);
}
static
BOOL
get_fpword
(
unsigned
short
*
ret
)
{
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
unsigned
short
fpword
;
__asm__
__volatile__
(
"fstcw %0"
:
"=m"
(
fpword
)
);
*
ret
=
fpword
;
return
TRUE
;
#endif
return
FALSE
;
}
static
void
set_fpword
(
unsigned
short
fpword
)
{
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
__asm__
__volatile__
(
"fldcw %0"
:
:
"m"
(
fpword
)
);
#endif
}
static
void
test_double
(
void
)
{
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
ns
=
{
0
,
NULL
};
unsigned
short
fpword
;
static
const
struct
{
double
val
;
...
...
@@ -2155,6 +2174,34 @@ static void test_double(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t>-INF</t>"
,
__LINE__
);
if
(
!
get_fpword
(
&
fpword
))
{
skip
(
"can't get floating point control word
\n
"
);
WsFreeWriter
(
writer
);
return
;
}
ok
(
fpword
==
0x27f
,
"got %04x
\n
"
,
fpword
);
set_fpword
(
0x1f7f
);
get_fpword
(
&
fpword
);
ok
(
fpword
==
0x1f7f
,
"got %04x
\n
"
,
fpword
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
text
.
value
=
100000000000000
;
hr
=
WsWriteText
(
writer
,
&
text
.
text
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t>100000000000000</t>"
,
__LINE__
);
get_fpword
(
&
fpword
);
ok
(
fpword
==
0x1f7f
,
"got %04x
\n
"
,
fpword
);
set_fpword
(
0x27f
);
WsFreeWriter
(
writer
);
}
...
...
dlls/webservices/webservices_private.h
View file @
35c09b52
...
...
@@ -35,8 +35,8 @@ WS_XML_UTF8_TEXT *alloc_utf8_text( const unsigned char *, ULONG ) DECLSPEC_HIDDE
HRESULT
append_attribute
(
WS_XML_ELEMENT_NODE
*
,
WS_XML_ATTRIBUTE
*
)
DECLSPEC_HIDDEN
;
void
free_attribute
(
WS_XML_ATTRIBUTE
*
)
DECLSPEC_HIDDEN
;
WS_TYPE
map_value_type
(
WS_VALUE_TYPE
)
DECLSPEC_HIDDEN
;
BOOL
set_fp
_rounding
(
unsigned
short
*
)
DECLSPEC_HIDDEN
;
void
restore_fp
_rounding
(
unsigned
short
)
DECLSPEC_HIDDEN
;
BOOL
set_fp
word
(
unsigned
short
,
unsigned
short
*
)
DECLSPEC_HIDDEN
;
void
restore_fp
word
(
unsigned
short
)
DECLSPEC_HIDDEN
;
HRESULT
set_output
(
WS_XML_WRITER
*
)
DECLSPEC_HIDDEN
;
HRESULT
set_input
(
WS_XML_READER
*
,
char
*
,
ULONG
)
DECLSPEC_HIDDEN
;
ULONG
get_type_size
(
WS_TYPE
,
const
WS_STRUCT_DESCRIPTION
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/webservices/writer.c
View file @
35c09b52
...
...
@@ -1373,9 +1373,9 @@ static HRESULT text_to_utf8text( const WS_XML_TEXT *text, WS_XML_UTF8_TEXT **ret
unsigned
short
fpword
;
ULONG
len
;
if
(
!
set_fp
_rounding
(
&
fpword
))
return
E_NOTIMPL
;
if
(
!
set_fp
word
(
0x37f
,
&
fpword
))
return
E_NOTIMPL
;
len
=
format_double
(
&
double_text
->
value
,
buf
);
restore_fp
_rounding
(
fpword
);
restore_fp
word
(
fpword
);
if
(
!
len
)
return
E_NOTIMPL
;
if
(
!
(
*
ret
=
alloc_utf8_text
(
buf
,
len
)))
return
E_OUTOFMEMORY
;
return
S_OK
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment