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

17 lines
398 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;
}
}
2020-05-14 10:34:37 +00:00
// ====
// compileViaYul: also
// compileToEwasm: also
// ----
// test() -> 0x20, 0x5, "12345"