mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
[FAST486]
Properly implement FRNDINT. svn path=/trunk/; revision=67835
This commit is contained in:
parent
c3e0cd41ca
commit
f0ffa72fc9
1 changed files with 5 additions and 13 deletions
|
@ -2088,9 +2088,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9)
|
||||||
/* FRNDINT */
|
/* FRNDINT */
|
||||||
case 0x3C:
|
case 0x3C:
|
||||||
{
|
{
|
||||||
INT Bits;
|
LONGLONG Result = 0LL;
|
||||||
ULONGLONG Result = 0ULL;
|
|
||||||
ULONGLONG Remainder;
|
|
||||||
|
|
||||||
if (FPU_GET_TAG(0) == FPU_TAG_EMPTY)
|
if (FPU_GET_TAG(0) == FPU_TAG_EMPTY)
|
||||||
{
|
{
|
||||||
|
@ -2111,18 +2109,12 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bits = min(max(0, (INT)FPU_ST(0).Exponent - FPU_REAL10_BIAS + 1), 64);
|
/* Do nothing if it's too big to not be an integer */
|
||||||
if (Bits == 64) break;
|
if (FPU_ST(0).Exponent >= FPU_REAL10_BIAS + 63) break;
|
||||||
|
|
||||||
if (Bits)
|
|
||||||
{
|
|
||||||
Result = FPU_ST(0).Mantissa >> (64 - Bits);
|
|
||||||
Remainder = FPU_ST(0).Mantissa & ((1 << (64 - Bits)) - 1);
|
|
||||||
}
|
|
||||||
else Remainder = FPU_ST(0).Mantissa;
|
|
||||||
|
|
||||||
/* Perform the rounding */
|
/* Perform the rounding */
|
||||||
Fast486FpuRound(State, &Result, FPU_ST(0).Sign, Remainder, 63 - Bits);
|
Fast486FpuToInteger(State, &FPU_ST(0), &Result);
|
||||||
|
Fast486FpuFromInteger(State, Result, &FPU_ST(0));
|
||||||
|
|
||||||
State->FpuStatus.Pe = TRUE;
|
State->FpuStatus.Pe = TRUE;
|
||||||
if (!State->FpuControl.Pm) Fast486FpuException(State);
|
if (!State->FpuControl.Pm) Fast486FpuException(State);
|
||||||
|
|
Loading…
Reference in a new issue