Merge pull request #9816 from ethereum/exp-base-literals

[Sol->Yul] Optimization for exponentiation when the base is a literal
This commit is contained in:
chriseth
2020-10-12 19:34:38 +02:00
committed by GitHub
10 changed files with 557 additions and 4 deletions
+8
View File
@@ -128,6 +128,14 @@ public:
/// signature: (base, exponent) -> power
std::string overflowCheckedIntExpFunction(IntegerType const& _type, IntegerType const& _exponentType);
/// @returns the name of the exponentiation function, specialized for literal base.
/// signature: exponent -> power
std::string overflowCheckedIntLiteralExpFunction(
RationalNumberType const& _baseType,
IntegerType const& _exponentType,
IntegerType const& _commonType
);
/// Generic unsigned checked exponentiation function.
/// Reverts if the result is larger than max.
/// signature: (base, exponent, max) -> power