Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
c63b203c
Commit
c63b203c
authored
Apr 18, 2018
by
DeltaBalances
Committed by
Francisco Giordano
Apr 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small SafeMath.sol gas improvements (add & mul). (#894)
parent
c191757c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
SafeMath.sol
contracts/math/SafeMath.sol
+4
-4
No files found.
contracts/math/SafeMath.sol
View file @
c63b203c
...
@@ -10,11 +10,11 @@ library SafeMath {
...
@@ -10,11 +10,11 @@ library SafeMath {
/**
/**
* @dev Multiplies two numbers, throws on overflow.
* @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) {
if (a == 0) {
return 0;
return 0;
}
}
uint256
c = a * b;
c = a * b;
assert(c / a == b);
assert(c / a == b);
return c;
return c;
}
}
...
@@ -40,8 +40,8 @@ library SafeMath {
...
@@ -40,8 +40,8 @@ library SafeMath {
/**
/**
* @dev Adds two numbers, throws on overflow.
* @dev Adds two numbers, throws on overflow.
*/
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
function add(uint256 a, uint256 b) internal pure returns (uint256
c
) {
uint256
c = a + b;
c = a + b;
assert(c >= a);
assert(c >= a);
return c;
return c;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment