mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
parent
1087d34a66
commit
c1983d1bef
11
LValue.cpp
11
LValue.cpp
@ -311,8 +311,6 @@ void StorageByteArrayElement::retrieveValue(SourceLocation const&, bool _remove)
|
||||
|
||||
void StorageByteArrayElement::storeValue(Type const&, SourceLocation const&, bool _move) const
|
||||
{
|
||||
//@todo optimize this
|
||||
|
||||
// stack: value ref byte_number
|
||||
m_context << u256(31) << eth::Instruction::SUB << u256(0x100) << eth::Instruction::EXP;
|
||||
// stack: value ref (1<<(8*(31-byte_number)))
|
||||
@ -335,19 +333,16 @@ void StorageByteArrayElement::setToZero(SourceLocation const&, bool _removeRefer
|
||||
{
|
||||
// stack: ref byte_number
|
||||
if (!_removeReference)
|
||||
m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2;
|
||||
m_context << eth::Instruction::DUP2 << eth::Instruction::DUP2;
|
||||
m_context << u256(31) << eth::Instruction::SUB << u256(0x100) << eth::Instruction::EXP;
|
||||
// stack: ref (1<<(8*(31-byte_number)))
|
||||
m_context << eth::Instruction::DUP2 << eth::Instruction::SLOAD;
|
||||
// stack: ref (1<<(8*(31-byte_number))) old_full_value
|
||||
// clear byte in old value
|
||||
m_context << eth::Instruction::SWAP1 << u256(0xff) << eth::Instruction::MUL << eth::Instruction::AND;
|
||||
m_context << eth::Instruction::SWAP1 << u256(0xff) << eth::Instruction::MUL;
|
||||
m_context << eth::Instruction::NOT << eth::Instruction::AND;
|
||||
// stack: ref old_full_value_with_cleared_byte
|
||||
m_context << eth::Instruction::SWAP1 << eth::Instruction::SSTORE;
|
||||
if (!_removeReference)
|
||||
m_context << eth::Instruction::SWAP1;
|
||||
else
|
||||
m_context << eth::Instruction::POP;
|
||||
}
|
||||
|
||||
StorageArrayLength::StorageArrayLength(CompilerContext& _compilerContext, const ArrayType& _arrayType):
|
||||
|
Loading…
Reference in New Issue
Block a user