summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/mingwex/math/modff.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/math/modff.c')
-rw-r--r--winsup/mingw/mingwex/math/modff.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/winsup/mingw/mingwex/math/modff.c b/winsup/mingw/mingwex/math/modff.c
index 9e34c7c95..072faace0 100644
--- a/winsup/mingw/mingwex/math/modff.c
+++ b/winsup/mingw/mingwex/math/modff.c
@@ -9,10 +9,11 @@ modff (float value, float* iptr)
{
float int_part;
unsigned short saved_cw;
+ unsigned short tmp_cw;
/* truncate */
asm ("fnstcw %0;" : "=m" (saved_cw)); /* save control word */
- asm ("fldcw %0;" : : "m" ((saved_cw & ~FE_ROUNDING_MASK)
- | FE_TOWARDZERO));
+ tmp_cw = (saved_cw & ~FE_ROUNDING_MASK) | FE_TOWARDZERO;
+ asm ("fldcw %0;" : : "m" (tmp_cw));
asm ("frndint;" : "=t" (int_part) : "0" (value)); /* round */
asm ("fldcw %0;" : : "m" (saved_cw)); /* restore saved cw */
if (iptr)