Skip to content

Commit

Permalink
Add optimization for EnumerableSet (#2588)
Browse files Browse the repository at this point in the history
Co-authored-by: Reason <Reason@Lee.com>
  • Loading branch information
linruigongzi and Reason authored Mar 13, 2021
1 parent 82e3ec3 commit d519472
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/utils/structs/EnumerableSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ library EnumerableSet {
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex

// Delete the slot where the moved value was stored
set._values.pop();
Expand Down

0 comments on commit d519472

Please sign in to comment.