Setting variables like this can pack them into a single slot:
uint128 v1 =1;
uint128 v2 =2;
But does return values also pack in this way? Does
returns (uint128, uint128)
also pack data?
Will experiment it later myself
solidity
Setting variables like this can pack them into a single slot:
uint128 v1 =1;
uint128 v2 =2;
But does return values also pack in this way? Does
returns (uint128, uint128)
also pack data?
Will experiment it later myself
Best Answer
Your example doesn't work,
uint
is an alias foruint256
, so in that specific example both variable use a full slot each. Maybe it was a typo and you meantuint128
?No. Input and outputs are abi encoded (see the documentation), that is, padded to 32 bytes each with some caveats for dynamic types. Thus, the following function would return two 32 bytes values :
I hope that answers your question.