diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-09 06:13:28 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-09-18 21:47:53 +0800 |
commit | 0b68d093b45b71bf976f8cf37a6b917aa29ac4e3 (patch) | |
tree | 958526e30f790578847c5500235262c7a6efe010 /libevmasm/ConstantOptimiser.cpp | |
parent | 47b8d998d13ad7365a897fc52496bf5fa1222040 (diff) | |
download | dexon-solidity-0b68d093b45b71bf976f8cf37a6b917aa29ac4e3.tar.gz dexon-solidity-0b68d093b45b71bf976f8cf37a6b917aa29ac4e3.tar.zst dexon-solidity-0b68d093b45b71bf976f8cf37a6b917aa29ac4e3.zip |
Move dataGas calculation helper to GasMeter
Diffstat (limited to 'libevmasm/ConstantOptimiser.cpp')
-rw-r--r-- | libevmasm/ConstantOptimiser.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/libevmasm/ConstantOptimiser.cpp b/libevmasm/ConstantOptimiser.cpp index 07ece12c..9844ba3a 100644 --- a/libevmasm/ConstantOptimiser.cpp +++ b/libevmasm/ConstantOptimiser.cpp @@ -94,15 +94,7 @@ bigint ConstantOptimisationMethod::simpleRunGas(AssemblyItems const& _items) bigint ConstantOptimisationMethod::dataGas(bytes const& _data) const { assertThrow(_data.size() > 0, OptimizerException, "Empty bytecode generated."); - if (m_params.isCreation) - { - bigint gas; - for (auto b: _data) - gas += b ? GasCosts::txDataNonZeroGas : GasCosts::txDataZeroGas; - return gas; - } - else - return GasCosts::createDataGas * _data.size(); + return bigint(GasMeter::dataGas(_data, m_params.isCreation)); } size_t ConstantOptimisationMethod::bytesRequired(AssemblyItems const& _items) |