mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
44da8507b1
Co-authored-by: Rodrigo Q. Saramago <rodrigoqsaramago@gmail.com>
30 lines
709 B
Solidity
30 lines
709 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: 35800
|
|
// executionCost: 85
|
|
// totalCost: 35885
|
|
// external:
|
|
// exp_neg_one(uint256): 1914
|
|
// exp_one(uint256): 1868
|
|
// exp_two(uint256): 1846
|
|
// exp_zero(uint256): 1889
|