solidity/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol
Nikola Matic fdc6699159 Rematerialize zero literals with default cleanup sequence
Add unused pruner step to the end of the default cleanup sequence
2023-09-04 15:40:33 +02:00

25 lines
600 B
Solidity

library Lib {
function set(mapping(uint => uint) storage m, uint key, uint value) public
{
m[key] = value;
}
}
contract Test {
mapping(uint => uint) m1;
mapping(uint => uint) m2;
function f() public returns (uint, uint, uint, uint, uint, uint)
{
Lib.set(m1, 0, 1);
Lib.set(m1, 2, 42);
Lib.set(m2, 0, 23);
Lib.set(m2, 2, 99);
return (m1[0], m1[1], m1[2], m2[0], m2[1], m2[2]);
}
}
// ----
// library: Lib
// f() -> 1, 0, 0x2a, 0x17, 0, 0x63
// gas irOptimized: 119635
// gas legacy: 124674
// gas legacyOptimized: 119669