solidity/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read.sol
2022-05-19 20:23:28 +02:00

20 lines
497 B
Solidity

contract C {
function f(bytes calldata x) public returns (uint r) {
assembly { r := x.offset }
}
function f(uint, bytes calldata x, uint) public returns (uint r, uint v) {
assembly {
r := x.offset
v := x.length
}
}
}
// ====
// compileToEwasm: also
// ----
// f(bytes): 0x20, 0, 0 -> 0x44
// f(bytes): 0x22, 0, 0, 0 -> 0x46
// f(uint256,bytes,uint256): 7, 0x60, 8, 2, 0 -> 0x84, 2
// f(uint256,bytes,uint256): 0, 0, 0 -> 0x24, 0x00