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 thesuccess
directly from the stack is sufficient. Removing those doubleiszero
could save 2 instructions each times those macros are called.Todo
Contracts where there are possible improvements:
create
but same principle applies)