2020-06-10 14:46:02 +00:00
|
|
|
library D {
|
2020-12-14 17:34:40 +00:00
|
|
|
function f(bytes calldata _x) internal pure returns (bytes1) {
|
2020-06-10 14:46:02 +00:00
|
|
|
return _x[0];
|
|
|
|
}
|
2020-12-14 17:34:40 +00:00
|
|
|
function g(bytes memory _x) internal pure returns (bytes1) {
|
2020-06-10 14:46:02 +00:00
|
|
|
return _x[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contract C {
|
|
|
|
using D for bytes;
|
2020-12-14 17:34:40 +00:00
|
|
|
function f(bytes calldata _x) public pure returns (bytes1, bytes1) {
|
2020-06-10 14:46:02 +00:00
|
|
|
return (_x.f(), _x.g());
|
|
|
|
}
|
|
|
|
}
|
2020-07-23 10:54:13 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-06-10 14:46:02 +00:00
|
|
|
// ----
|
|
|
|
// f(bytes): 0x20, 4, "abcd" -> 0x6100000000000000000000000000000000000000000000000000000000000000, 0x6100000000000000000000000000000000000000000000000000000000000000
|