From 64928b1c56babfa7c6f1926bcc1675830f2f375b Mon Sep 17 00:00:00 2001 From: clesaege Date: Fri, 31 Mar 2017 01:27:37 +0200 Subject: [PATCH] Remove unecessary check. c>=a is enough to check for overflow. Because we can't wrap around more than once. In case of overflow we both have a+b=b is an unnecessary check increasing gas cost and cost length. --- contracts/SafeMath.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/SafeMath.sol b/contracts/SafeMath.sol index 25275e6..adee7ee 100644 --- a/contracts/SafeMath.sol +++ b/contracts/SafeMath.sol @@ -14,11 +14,11 @@ contract SafeMath { function safeAdd(uint a, uint b) internal returns (uint) { uint c = a + b; - assert(c>=a && c>=b); + assert(c>=a); return c; } function assert(bool assertion) internal { if (!assertion) throw; } -} \ No newline at end of file +}