EVM Deep Dives: The Path to Shadowy Super Coder 🥷 💻 - Part 2
This is a good example of how to work memory opcodes ⇒ EVM playgroundW%20at~V%2F%2F%20MQ%20%7B0x2N%20memoryKwg8%201j_J32I11GpPUSHFpMgCn%20Be%209%20i7%20t*%20J)LOAD(js!uu%01!()*79BCFGIJKNQVWXYZ_dgjpquvwz~_)
If you are writing to an area of memory that hasn't been written to before, there is an additional memory expansion cost for using it for the first time.
Memory expansion costs scale linearly for the first 724 bytes and quadratically after that.
Note that all locations in memory are well-defined initially as zero which is why we see 2200000000000000000000000000000000000000000000000000000000000000 added to our memory.
64 hex = 32 bytes
Remember memory is a byte array meaning we can start our reads (and our writes) from any memory location
MLOAD(0) ⇒ 1111111111111111111111111111111111111111111111111111111111111111(64 hex) MLOAD(20) ⇒ 2233000000000000000000000000000000000000000000000000000000000000(64hex) MLOAD(21) ⇒ 3300000000000000000000000000000000000000000000000000000000000000(64hex)