All Questions
6 questions
1
vote
0
answers
36
views
Does Solidity require pointer alignment in memory?
Solidity seems to allocate memory under pointers being multiples of 32. This is understandable since most allocation sizes are multiples of 32. But is it a requirement or is it fine if a Yul inline ...
3
votes
1
answer
31
views
If the `Free pointer` is stored at `0x40` what do the rest of `0x41` to `0x5f` do?
Layout in Memory
Solidity reserves four 32-byte slots, with specific byte ranges (inclusive of endpoints) being used as follows:
0x00 - 0x3f (64 bytes): scratch space for hashing methods
0x40 - ...
0
votes
1
answer
33
views
Is it safe to reuse same memory slots for both inputs and ouputs when working with assembly call?
Is it safe to reuse memory for both inputs and ouputs when working with assembly call?
If not, what can go wrong?
Contract below uses assembly to call Target
contract YulStaticCall {
function ...
1
vote
2
answers
71
views
How are bytes and bytes32 different in inline-assembly?
function mloadTest1() public pure returns(bytes memory) {
bytes memory a;
assembly {
a :=mload(0x40)
}
return a; // 0x20
}
function mloadTest2() public pure returns(bytes32) {
...
1
vote
1
answer
307
views
Dynamic arrays in memory layout
I think i've figured out dynamic memory layout for dynamic arrays, but could use a check on my reasoning. Consider the contract :
pragma solidity >=0.8.4;
struct state_type {
bytes b;...
1
vote
1
answer
660
views
Weird behavior when dealing with uint32 memory array in Yul
There's something I can't understand in the way Solidity handles dynamic-size memory arrays. For instance, let us consider the following contract:
pragma solidity ^0.8.0; ...