Unverified Commit 34be16d9 by Santiago Palladino Committed by GitHub

Merge pull request #522 from emn178/feature/improve_mul

improve mul performance and reduce gas cost
parents 14ae881e 5ad07e18
......@@ -7,8 +7,11 @@ pragma solidity ^0.4.11;
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(a == 0 || c / a == b);
assert(c / a == b);
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