mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:23:01 +00:00
[FAST486]
Fix several division related problems: - In UnsignedDivMod128, fix the leading zero calculation for 128-bit numbers. - In Fast486FpuDivide, there's no need to increase the exponent by 64 (adding zeros at the end of a number after the decimal point changes nothing). - FDIV/FDIVR were reversed svn path=/trunk/; revision=67820
This commit is contained in:
parent
ec471e2759
commit
de0880752b
1 changed files with 6 additions and 7 deletions
|
@ -203,9 +203,9 @@ UnsignedDivMod128(ULONGLONG DividendLow,
|
||||||
* Calculate the number of significant bits the current
|
* Calculate the number of significant bits the current
|
||||||
* divisor has more than the original divisor
|
* divisor has more than the original divisor
|
||||||
*/
|
*/
|
||||||
Bits = CountLeadingZeros64(Divisor) + 64;
|
Bits = CountLeadingZeros64(Divisor);
|
||||||
Bits -= (CurrentHigh > 0ULL) ? CountLeadingZeros64(CurrentHigh) : 64;
|
if (CurrentHigh > 0ULL) Bits -= CountLeadingZeros64(CurrentHigh);
|
||||||
Bits -= (CurrentLow > 0ULL) ? CountLeadingZeros64(CurrentLow) : 64;
|
else Bits -= CountLeadingZeros64(CurrentLow);
|
||||||
|
|
||||||
if (Bits)
|
if (Bits)
|
||||||
{
|
{
|
||||||
|
@ -923,11 +923,10 @@ Fast486FpuDivide(PFAST486_STATE State,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the exponent of the result */
|
/* Calculate the exponent of the result */
|
||||||
Exponent = (LONG)FirstOperand->Exponent - (LONG)SecondOperand->Exponent - 64;
|
Exponent = (LONG)FirstOperand->Exponent - (LONG)SecondOperand->Exponent - 1;
|
||||||
|
|
||||||
/* Divide the two mantissas */
|
/* Divide the two mantissas */
|
||||||
Remainder = UnsignedDivMod128(0ULL,
|
Remainder = UnsignedDivMod128(0ULL,
|
||||||
/* Notice the 64 above - this is the high part */
|
|
||||||
FirstOperand->Mantissa,
|
FirstOperand->Mantissa,
|
||||||
SecondOperand->Mantissa,
|
SecondOperand->Mantissa,
|
||||||
&QuotientLow,
|
&QuotientLow,
|
||||||
|
@ -1169,14 +1168,14 @@ Fast486FpuArithmeticOperation(PFAST486_STATE State,
|
||||||
/* FDIV */
|
/* FDIV */
|
||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
Fast486FpuDivide(State, DestOperand, SourceOperand, DestOperand);
|
Fast486FpuDivide(State, SourceOperand, DestOperand, DestOperand);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FDIVR */
|
/* FDIVR */
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
Fast486FpuDivide(State, SourceOperand, DestOperand, DestOperand);
|
Fast486FpuDivide(State, DestOperand, SourceOperand, DestOperand);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue