SetProtocol / set-protocol-v2

Set Protocol V2
118 stars 94 forks source link

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

Open gzliudan opened 2 years ago

gzliudan commented 2 years ago

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 ≥.