X86: Actual change that fixes div. How did that happen?

This commit is contained in:
Gabe Black 2010-05-12 00:49:12 -07:00
parent 776e8d5c8e
commit cc76842f83

View file

@ -620,15 +620,19 @@ let {{
remaining--; remaining--;
} }
if (dividend & (ULL(1) << 63)) { if (dividend & (ULL(1) << 63)) {
bool highBit = false;
if (dividend < divisor && remaining) { if (dividend < divisor && remaining) {
highBit = true;
dividend = (dividend << 1) | dividend = (dividend << 1) |
bits(SrcReg1, remaining - 1); bits(SrcReg1, remaining - 1);
quotient <<= 1; quotient <<= 1;
remaining--; remaining--;
} }
if (highBit || divisor <= dividend) {
quotient++; quotient++;
dividend -= divisor; dividend -= divisor;
} }
}
remainder = dividend; remainder = dividend;
} else { } else {
//Shift in bits from the low order portion of the dividend //Shift in bits from the low order portion of the dividend