mirror of
https://github.com/reactos/reactos.git
synced 2024-08-23 11:52:51 +00:00
[FAST486]
Fix Fast486FpuToInteger. svn path=/trunk/; revision=67846
This commit is contained in:
parent
d9dcc9a022
commit
ac3616d42c
|
@ -310,8 +310,7 @@ Fast486FpuToInteger(PFAST486_STATE State,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FPU_IS_NAN(Value) || !FPU_IS_NORMALIZED(Value)
|
if (FPU_IS_NAN(Value) || !FPU_IS_NORMALIZED(Value) || (UnbiasedExp >= 63))
|
||||||
|| (UnbiasedExp < 0) || (UnbiasedExp > 63))
|
|
||||||
{
|
{
|
||||||
/* Raise an invalid operation exception */
|
/* Raise an invalid operation exception */
|
||||||
State->FpuStatus.Ie = TRUE;
|
State->FpuStatus.Ie = TRUE;
|
||||||
|
@ -328,11 +327,31 @@ Fast486FpuToInteger(PFAST486_STATE State,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UnbiasedExp >= 0)
|
||||||
|
{
|
||||||
Bits = 63 - UnbiasedExp;
|
Bits = 63 - UnbiasedExp;
|
||||||
|
|
||||||
/* Calculate the result and the remainder */
|
/* Calculate the result and the remainder */
|
||||||
*Result = (LONGLONG)(Value->Mantissa >> Bits);
|
*Result = (LONGLONG)(Value->Mantissa >> Bits);
|
||||||
Remainder = Value->Mantissa & ((1 << Bits) - 1);
|
Remainder = Value->Mantissa & ((1 << Bits) - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The result is zero */
|
||||||
|
*Result = 0LL;
|
||||||
|
|
||||||
|
if (UnbiasedExp > -64)
|
||||||
|
{
|
||||||
|
Bits = 65 + UnbiasedExp;
|
||||||
|
Remainder = Value->Mantissa >> (64 - Bits);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Too small to even have a remainder */
|
||||||
|
Bits = 1;
|
||||||
|
Remainder = 0ULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* The result must be positive here */
|
/* The result must be positive here */
|
||||||
ASSERT(*Result >= 0LL);
|
ASSERT(*Result >= 0LL);
|
||||||
|
|
Loading…
Reference in a new issue