mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
19 lines
391 B
Solidity
19 lines
391 B
Solidity
pragma abicoder v2;
|
|
|
|
library L {
|
|
function reverse(bytes calldata _b) internal pure returns (bytes1, bytes1) {
|
|
return (_b[1], _b[0]);
|
|
}
|
|
}
|
|
|
|
contract C {
|
|
using L for bytes;
|
|
|
|
function test(uint, bytes calldata _b, uint) external pure returns (bytes1, bytes1) {
|
|
return _b.reverse();
|
|
}
|
|
}
|
|
|
|
// ----
|
|
// test(uint256,bytes,uint256): 7, 0x60, 4, 2, "ab" -> "b", "a"
|