mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove namespace prefixes.
This commit is contained in:
parent
81ed5612bc
commit
cad767de61
@ -73,7 +73,7 @@ bigint ConstantOptimisationMethod::simpleRunGas(AssemblyItems const& _items)
|
|||||||
bigint gas = 0;
|
bigint gas = 0;
|
||||||
for (AssemblyItem const& item: _items)
|
for (AssemblyItem const& item: _items)
|
||||||
if (item.type() == Push)
|
if (item.type() == Push)
|
||||||
gas += GasMeter::runGas(eth::Instruction::PUSH1);
|
gas += GasMeter::runGas(Instruction::PUSH1);
|
||||||
else if (item.type() == Operation)
|
else if (item.type() == Operation)
|
||||||
gas += GasMeter::runGas(item.instruction());
|
gas += GasMeter::runGas(item.instruction());
|
||||||
return gas;
|
return gas;
|
||||||
@ -119,7 +119,7 @@ void ConstantOptimisationMethod::replaceConstants(
|
|||||||
bigint LiteralMethod::gasNeeded()
|
bigint LiteralMethod::gasNeeded()
|
||||||
{
|
{
|
||||||
return combineGas(
|
return combineGas(
|
||||||
simpleRunGas({eth::Instruction::PUSH1}),
|
simpleRunGas({Instruction::PUSH1}),
|
||||||
// PUSHX plus data
|
// PUSHX plus data
|
||||||
(m_params.isCreation ? c_txDataNonZeroGas : c_createDataGas) + dataGas(),
|
(m_params.isCreation ? c_txDataNonZeroGas : c_createDataGas) + dataGas(),
|
||||||
0
|
0
|
||||||
@ -131,16 +131,16 @@ CodeCopyMethod::CodeCopyMethod(Params const& _params, u256 const& _value):
|
|||||||
{
|
{
|
||||||
m_copyRoutine = AssemblyItems{
|
m_copyRoutine = AssemblyItems{
|
||||||
u256(0),
|
u256(0),
|
||||||
eth::Instruction::DUP1,
|
Instruction::DUP1,
|
||||||
eth::Instruction::MLOAD, // back up memory
|
Instruction::MLOAD, // back up memory
|
||||||
u256(32),
|
u256(32),
|
||||||
AssemblyItem(PushData, u256(1) << 16), // has to be replaced
|
AssemblyItem(PushData, u256(1) << 16), // has to be replaced
|
||||||
eth::Instruction::DUP4,
|
Instruction::DUP4,
|
||||||
eth::Instruction::CODECOPY,
|
Instruction::CODECOPY,
|
||||||
eth::Instruction::DUP2,
|
Instruction::DUP2,
|
||||||
eth::Instruction::MLOAD,
|
Instruction::MLOAD,
|
||||||
eth::Instruction::SWAP2,
|
Instruction::SWAP2,
|
||||||
eth::Instruction::MSTORE
|
Instruction::MSTORE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ AssemblyItems ComputeMethod::findRepresentation(u256 const& _value)
|
|||||||
if (lowerPart > 0)
|
if (lowerPart > 0)
|
||||||
newRoutine += AssemblyItems{Instruction::ADD};
|
newRoutine += AssemblyItems{Instruction::ADD};
|
||||||
else if (lowerPart < 0)
|
else if (lowerPart < 0)
|
||||||
newRoutine.push_back(eth::Instruction::SUB);
|
newRoutine.push_back(Instruction::SUB);
|
||||||
|
|
||||||
bigint newGas = gasNeeded(newRoutine);
|
bigint newGas = gasNeeded(newRoutine);
|
||||||
if (newGas < bestGas)
|
if (newGas < bestGas)
|
||||||
@ -215,7 +215,7 @@ AssemblyItems ComputeMethod::findRepresentation(u256 const& _value)
|
|||||||
|
|
||||||
bigint ComputeMethod::gasNeeded(AssemblyItems const& _routine)
|
bigint ComputeMethod::gasNeeded(AssemblyItems const& _routine)
|
||||||
{
|
{
|
||||||
size_t numExps = count(_routine.begin(), _routine.end(), eth::Instruction::EXP);
|
size_t numExps = count(_routine.begin(), _routine.end(), Instruction::EXP);
|
||||||
return combineGas(
|
return combineGas(
|
||||||
simpleRunGas(_routine) + numExps * (c_expGas + c_expByteGas),
|
simpleRunGas(_routine) + numExps * (c_expGas + c_expByteGas),
|
||||||
// Data gas for routine: Some bytes are zero, but we ignore them.
|
// Data gas for routine: Some bytes are zero, but we ignore them.
|
||||||
|
Loading…
Reference in New Issue
Block a user