Commit 20126676 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Don't use fegetenv in nearbyintf.

parent 5d9d195f
......@@ -6873,13 +6873,25 @@ double CDECL nearbyint(double x)
*/
float CDECL nearbyintf(float x)
{
fenv_t env;
BOOL update_cw, update_sw;
unsigned int cw, sw;
fegetenv(&env);
_control87(_MCW_EM, _MCW_EM);
_setfp(&cw, 0, &sw, 0);
update_cw = !(cw & _EM_INEXACT);
update_sw = !(sw & _SW_INEXACT);
if (update_cw)
{
cw |= _EM_INEXACT;
_setfp(&cw, _EM_INEXACT, NULL, 0);
}
x = rintf(x);
feclearexcept(FE_INEXACT);
feupdateenv(&env);
if (update_cw || update_sw)
{
sw = 0;
cw &= ~_EM_INEXACT;
_setfp(update_cw ? &cw : NULL, _EM_INEXACT,
update_sw ? &sw : NULL, _SW_INEXACT);
}
return x;
}
......
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