Add math control state functions for intel

This commit is contained in:
James Urquhart 2015-02-10 22:54:18 +00:00
parent 47d5d80e80
commit a3f8227541
2 changed files with 42 additions and 13 deletions

View file

@ -130,17 +130,42 @@ F32 Platform::getRandom()
return sgPlatRandom.randF();
}
#if defined(i386) || defined(__x86_64__)
U32 Platform::getMathControlState()
{
U16 cw;
asm("fstcw %0" : "=m" (cw) :);
return cw;
}
void Platform::setMathControlState(U32 state)
{
U16 cw = state;
asm("fldcw %0" : : "m" (cw));
}
void Platform::setMathControlStateKnown()
{
U16 cw = 0x27F;
asm("fldcw %0" : : "m" (cw));
}
#else
U32 Platform::getMathControlState()
{
return 0;
}
void Platform::setMathControlStateKnown()
{
}
void Platform::setMathControlState(U32 state)
{
}
void Platform::setMathControlStateKnown()
{
}
#endif