Shave off an SLOAD op in ReentrancyGuard.

This commit is contained in:
Lawrence 2019-03-14 15:48:38 -04:00 committed by Amir Bandeali
parent e6971c45c8
commit 620eb2a3be

View File

@ -27,10 +27,8 @@ contract ReentrancyGuard {
/// @dev Functions with this modifer cannot be reentered. /// @dev Functions with this modifer cannot be reentered.
modifier nonReentrant() { modifier nonReentrant() {
// Increment the counter. // Increment and remember the current counter value.
reentrancyGuardCounter += 1; uint256 localCounter = ++reentrancyGuardCounter;
// Remember the current counter value.
uint256 localCounter = reentrancyGuardCounter;
// Call the function. // Call the function.
_; _;
// If the counter value is different from what we remember, // If the counter value is different from what we remember,