mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use .slot and .offest to access storage items.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
uint[] x;
|
||||
fallback() external {
|
||||
uint y_slot = 2;
|
||||
uint y_offset = 3;
|
||||
uint[] storage y = x;
|
||||
assembly {
|
||||
pop(y_slot)
|
||||
pop(y_offset)
|
||||
}
|
||||
y[0] = 2;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
Reference in New Issue
Block a user