Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a double ended queue #3153
Add a double ended queue #3153
Changes from 4 commits
d3854ee
b5358a9
6140b20
1157045
9e9dd6d
bfb6d57
c7ec6fd
933337e
b7fb096
17a8fea
8eea114
595d5ef
914e1df
c5ef056
1cf95f1
adc9a5a
0649a31
bbb091d
3aff9f0
35064a7
248d479
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Why don't we do just use checked arithmetic and even SafeCast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
begin
andend
are only updated by ++ or --. They are not expected to overflow (it would take 2**127 calls for it to overflow).a consequence is that any checks (like the safemath that solidity includes by default and safecast) would just be wasted gas.
For example, on a
pushX
/popX
operation, unchecked saves ~100 gas per operation. Not sure what the safecast impact would be here, but it would be wasted gas