Updated optimization

This commit is contained in:
The3D 2020-10-23 10:57:22 +02:00
parent 302a19a1bc
commit dadebe9d2c

View File

@ -100,7 +100,7 @@ library WadRayMath {
uint256 result = a * b + halfRAY; uint256 result = a * b + halfRAY;
require((result - halfRAY) / a == b, Errors.MULTIPLICATION_OVERFLOW); require(result >= halfRAY && (result - halfRAY) / a == b, Errors.MULTIPLICATION_OVERFLOW);
return result / RAY; return result / RAY;
} }
@ -118,7 +118,7 @@ library WadRayMath {
uint256 result = a * RAY + halfB; uint256 result = a * RAY + halfB;
require((result - halfB) / RAY == a, Errors.MULTIPLICATION_OVERFLOW); require(result >= halfB && (result - halfB) / RAY == a, Errors.MULTIPLICATION_OVERFLOW);
return result / b; return result / b;
} }