solidity/test/libsolidity/gasTests/exp_optimized.sol
Alex Beregszaszi 0b6f87ef3c Update tests
2021-05-31 10:43:18 +01:00

30 lines
710 B
Solidity

pragma abicoder v2;
contract C {
function exp_neg_one(uint exponent) public returns(int) {
unchecked { return (-1)**exponent; }
}
function exp_two(uint exponent) public returns(uint) {
unchecked { return 2**exponent; }
}
function exp_zero(uint exponent) public returns(uint) {
unchecked { return 0**exponent; }
}
function exp_one(uint exponent) public returns(uint) {
unchecked { return 1**exponent; }
}
}
// ====
// optimize: true
// optimize-yul: true
// ----
// creation:
// codeDepositCost: 41400
// executionCost: 100
// totalCost: 41500
// external:
// exp_neg_one(uint256): 1912
// exp_one(uint256): 1865
// exp_two(uint256): 1843
// exp_zero(uint256): 1887