From c63b203c1d1800c9a8b5f51f0b444187fdc6c185 Mon Sep 17 00:00:00 2001 From: DeltaBalances <30391324+DeltaBalances@users.noreply.github.com> Date: Wed, 18 Apr 2018 00:16:30 +0200 Subject: [PATCH] Small SafeMath.sol gas improvements (add & mul). (#894) --- contracts/math/SafeMath.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/math/SafeMath.sol b/contracts/math/SafeMath.sol index fb6a7cccf..7923149d5 100644 --- a/contracts/math/SafeMath.sol +++ b/contracts/math/SafeMath.sol @@ -10,11 +10,11 @@ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ - function mul(uint256 a, uint256 b) internal pure returns (uint256) { + function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } - uint256 c = a * b; + c = a * b; assert(c / a == b); return c; } @@ -40,8 +40,8 @@ library SafeMath { /** * @dev Adds two numbers, throws on overflow. */ - function add(uint256 a, uint256 b) internal pure returns (uint256) { - uint256 c = a + b; + function add(uint256 a, uint256 b) internal pure returns (uint256 c) { + c = a + b; assert(c >= a); return c; }