Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

perf(BytesArrayUtils): reduce gas of function toBool#258

Open
gzliudan wants to merge 1 commit intoSetProtocol:master from
gzliudan:BytesArrayUtils
Open

perf(BytesArrayUtils): reduce gas of function toBool #258
gzliudan wants to merge 1 commit intoSetProtocol:master from
gzliudan:BytesArrayUtils

Conversation

@gzliudan
Copy link
Contributor

@gzliudan gzliudan commented Jul 8, 2022

In Solidity, there is no single op-code for ≤ or ≥ expressions. Solidity compiler executes the LT/GT (less than/greater than) op-code and afterwards it executes an ISZERO op-code to check if the result of the previous comparison (LT/ GT) is zero and validate it or not. So the use of < and > are cheaper than ≤ and ≥.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /