Author: aandrejevic
Date: Wed May 20 17:23:55 2015
New Revision: 67835
URL:
http://svn.reactos.org/svn/reactos?rev=67835&view=rev
Log:
[FAST486]
Properly implement FRNDINT.
Modified:
trunk/reactos/lib/fast486/fpu.c
Modified: trunk/reactos/lib/fast486/fpu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/fpu.c?rev=6783…
==============================================================================
--- trunk/reactos/lib/fast486/fpu.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/fpu.c [iso-8859-1] Wed May 20 17:23:55 2015
@@ -2088,9 +2088,7 @@
/* FRNDINT */
case 0x3C:
{
- INT Bits;
- ULONGLONG Result = 0ULL;
- ULONGLONG Remainder;
+ LONGLONG Result = 0LL;
if (FPU_GET_TAG(0) == FPU_TAG_EMPTY)
{
@@ -2111,18 +2109,12 @@
}
}
- Bits = min(max(0, (INT)FPU_ST(0).Exponent - FPU_REAL10_BIAS + 1), 64);
- if (Bits == 64) 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;
+ /* Do nothing if it's too big to not be an integer */
+ if (FPU_ST(0).Exponent >= FPU_REAL10_BIAS + 63) break;
/* 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;
if (!State->FpuControl.Pm) Fast486FpuException(State);