Skip to content

Conversation

@CodeSandwich
Copy link
Contributor

Fixes #nothing

This PR reduces gas needed to perform safe downcasting of signed integers by 23 gas ('gasleft' microbenchmark went down from 110 to 87 gas). Both underflows and overflows are still caught, but instead of two comparisons there's only one.

PR Checklist

  • Tests
  • Documentation
  • Changelog entry

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very simple, I like it. Thanks!

Keep them coming!

@frangio frangio merged commit 580b7ab into OpenZeppelin:master Jul 20, 2022
@CodeSandwich CodeSandwich deleted the cheaper_cast branch July 20, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants