mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
18 lines
377 B
Solidity
18 lines
377 B
Solidity
library L {
|
|
function add(bytes2 a, bytes2 b) internal pure returns (bytes2) {
|
|
return bytes2(uint16(a) + uint16(b));
|
|
}
|
|
}
|
|
|
|
contract C {
|
|
using L for bytes2;
|
|
|
|
function sum(bytes2 a, bytes2 b) public returns (bytes2) {
|
|
return a.add(b);
|
|
}
|
|
}
|
|
// ====
|
|
// compileViaYul: also
|
|
// ----
|
|
// sum(bytes2, bytes2): left(0x1100), left(0x0022) -> left(0x1122)
|