diff --git a/contracts/math/SafeMath.sol b/contracts/math/SafeMath.sol index 58a8da1c3..9336e4609 100644 --- a/contracts/math/SafeMath.sol +++ b/contracts/math/SafeMath.sol @@ -10,7 +10,7 @@ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 @@ -18,8 +18,9 @@ library SafeMath { return 0; } - c = _a * _b; + uint256 c = _a * _b; assert(c / _a == _b); + return c; } @@ -28,9 +29,10 @@ library SafeMath { */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 - // uint256 c = _a / _b; + uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold - return _a / _b; + + return c; } /** @@ -38,15 +40,18 @@ library SafeMath { */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); - return _a - _b; + uint256 c = _a - _b; + + return c; } /** * @dev Adds two numbers, throws on overflow. */ - function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - c = _a + _b; + function add(uint256 _a, uint256 _b) internal pure returns (uint256) { + uint256 c = _a + _b; assert(c >= _a); + return c; } }