Fixed rounding in MulDiv.

This commit is contained in:
Thuy Nguyen 1999-07-18 18:36:18 +00:00 committed by Alexandre Julliard
parent effc55ea83
commit 6e133d5d3b

View file

@ -1017,12 +1017,12 @@ INT WINAPI MulDiv(
#if (SIZEOF_LONG_LONG >= 8)
long long ret;
if (!nDivisor) return -1;
ret = ((long long)nMultiplicand * nMultiplier) / nDivisor;
ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
if ((ret > 2147483647) || (ret < -2147483647)) return -1;
return ret;
#else
if (!nDivisor) return -1;
return (nMultiplicand * nMultiplier) / nDivisor;
return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
#endif
}
/*******************************************************************