mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Updated optimization
This commit is contained in:
parent
302a19a1bc
commit
dadebe9d2c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user