Commit 5ad07e18 by Chen Yi-Cyuan

improve mum performance and reduce gas cost

parent 39d6c920
...@@ -7,8 +7,11 @@ pragma solidity ^0.4.11; ...@@ -7,8 +7,11 @@ pragma solidity ^0.4.11;
*/ */
library SafeMath { library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) { function mul(uint256 a, uint256 b) internal constant returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b; uint256 c = a * b;
assert(a == 0 || c / a == b); assert(c / a == b);
return c; return c;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment