Files
uniswap-v2/contracts/libraries/Math.sol
Noah Zinsmeister 4e4546d0a9 bump solc to 0.5.14
chainId implementation (commented out for now)

improve events

move safeTransfer in UniswapV2

tweak error messages
2019-12-12 14:52:15 -05:00

25 lines
572 B
Solidity

pragma solidity 0.5.14;
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x <= y ? x : y;
}
function clamp112(uint y) internal pure returns (uint112 z) {
z = y <= uint112(-1) ? uint112(y) : uint112(-1);
}
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
uint x = (y + 1) / 2;
z = y;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}