refactor max and min out of SafeMath

This commit is contained in:
Francisco Giordano
2017-07-02 13:01:55 -03:00
parent a66f5f8f03
commit ba383a6d20
2 changed files with 24 additions and 17 deletions

24
contracts/math/Math.sol Normal file
View File

@ -0,0 +1,24 @@
pragma solidity ^0.4.11;
/**
* @title Math
* @dev Assorted math operations
*/
contract Math {
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
}