Skip to content

Commit

Permalink
Merge pull request blockful-io#180 from blackbeard002/gas
Browse files Browse the repository at this point in the history
refactor: sloads and increments in assembly for gas optimization. blockful-io#179
  • Loading branch information
0xneves authored Jan 16, 2024
2 parents ab16bb6 + 26a3fad commit 41d7563
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions contracts/Swaplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ contract Swaplace is SwapFactory, ISwaplace, IERC165 {
assets[i].amountOrId
);
unchecked {
i++;
assembly {
i := mload(0x40)
i := add(i, 1)
mstore(0x40, i)
}
}
}

Expand All @@ -78,7 +82,11 @@ contract Swaplace is SwapFactory, ISwaplace, IERC165 {
assets[i].amountOrId
);
unchecked {
i++;
assembly {
i := mload(0x40)
i := add(i, 1)
mstore(0x40, i)
}
}
}

Expand Down

0 comments on commit 41d7563

Please sign in to comment.