You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several contracts where there are two iszero in a row before a jumpi to conditionally jump if a value is different from 0. But those are not necessary.
From evm.codes:
b: the program counter will be altered with the new value only if this value is different from 0. Otherwise, the program counter is simply incremented and the next instruction will be executed.
For example, in case of a call (delegate, static, or classic), they return success:
So, if there is a jumpi just after a call, there is no need to do iszero iszero.
Using the success directly from the stack is sufficient.
Removing those double iszero could save 2 instructions each times those macros are called.
Overview
There are several contracts where there are two
iszero
in a row before ajumpi
to conditionally jump if a value is different from 0. But those are not necessary.From evm.codes:
For example, in case of a
call
(delegate, static, or classic), they returnsuccess
:So, if there is a
jumpi
just after a call, there is no need to doiszero iszero
.Using the
success
directly from the stack is sufficient.Removing those double
iszero
could save 2 instructions each times those macros are called.Todo
Contracts where there are possible improvements:
create
but same principle applies)The text was updated successfully, but these errors were encountered: