solidity/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol

14 lines
343 B
Solidity
Raw Normal View History

contract C {
function test() public returns (bytes memory) {
bytes memory x = new bytes(5);
for (uint256 i = 0; i < x.length; ++i) x[i] = bytes1(uint8(i + 1));
assembly {
mstore(add(x, 32), "12345678901234567890123456789012")
}
return x;
}
}
// ----
// test() -> 0x20, 0x5, "12345"