1

While debugging in RemixIDE with 'optimize=true', I noticed that the Solidity code address(0xAAAA) generates the following opcodes, which only compute 20 bytes 1s:

PUSH1 0x1
PUSH1 0x1
PUSH1 0xa0
SHL
SUB

I found in the ConstantOptimiser.cpp file in the Solidity repo that there is a method called 'findRepresentation', which decomposes constants larger than 255. Doesn't this consume more gas than directly pushing the constant? Why is this optimization performed?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.