From f17fe2fe2057a57560e5310539634662130a75d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 8 Dec 2012 17:44:38 +0000 Subject: [PATCH] [MSVCRT] - Properly implement and export _fpcontrol_s svn path=/trunk/; revision=57823 --- reactos/dll/win32/msvcrt/msvcrt.spec | 2 +- reactos/lib/sdk/crt/float/i386/cntrlfp.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/reactos/dll/win32/msvcrt/msvcrt.spec b/reactos/dll/win32/msvcrt/msvcrt.spec index 2e238c7c81a..d7d07f6b9a3 100644 --- a/reactos/dll/win32/msvcrt/msvcrt.spec +++ b/reactos/dll/win32/msvcrt/msvcrt.spec @@ -302,7 +302,7 @@ @ extern _commode @ cdecl _control87(long long) @ cdecl _controlfp(long long) -# @ cdecl _controlfp_s(ptr long long) +@ cdecl _controlfp_s(ptr long long) @ cdecl _copysign( double double ) @ varargs _cprintf(str) # stub _cprintf_l diff --git a/reactos/lib/sdk/crt/float/i386/cntrlfp.c b/reactos/lib/sdk/crt/float/i386/cntrlfp.c index 18745eaaf6f..f3c3ccf5aa0 100644 --- a/reactos/lib/sdk/crt/float/i386/cntrlfp.c +++ b/reactos/lib/sdk/crt/float/i386/cntrlfp.c @@ -120,15 +120,15 @@ unsigned int CDECL _control87(unsigned int newval, unsigned int mask) int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask) { #ifdef __i386__ - unsigned int flags; - - FIXME("(%p %u %u) semi-stub\n", cur, newval, mask); - - flags = _control87( newval, mask & ~_EM_DENORMAL ); - - if(cur) - *cur = flags; - + unsigned int val; + + if (!MSVCRT_CHECK_PMT( !(newval & mask & ~(_MCW_EM | _MCW_IC | _MCW_RC | _MCW_PC | _MCW_DN)))) + { + if (cur) *cur = _controlfp( 0, 0 ); /* retrieve it anyway */ + return MSVCRT_EINVAL; + } + val = _controlfp( newval, mask ); + if (cur) *cur = val; return 0; #else FIXME(":Not Implemented!\n"); -- 2.17.1