I'm attempting to set bits in the mxcsr control register. I know how to do this with gcc (fesetenv
), but I haven't been able to get this working MSVC. The possibilities I've considered are:
_controlfp
function, which doesn't seem to match up one to one (note that I may be completely misunderstanding this function, but all of this is poorly documented).Specifically, I want to set these bits:
Any ideas for how I can do this?
The _controlfp
routine is a generic routine that works across ARM, x86 and x64 - there is no reason to expect it to use the same bits the actual hardware registers use.
From the article _controlfp, it appears that _controlfp
does not allow for individual control of input and output denormals, but sets them together.
To set the x64 SSE2 to flush denormal operands and outputs to zero, use
_controlfp(_DN_FLUSH, _MCW_DN);