Clear all value types prior to storing.

This commit is contained in:
chriseth 2016-10-31 16:40:30 +01:00
parent 681b130dc8
commit 9920e88eea

View File

@ -231,10 +231,7 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc
m_context m_context
<< (u256(0x1) << (256 - 8 * dynamic_cast<FixedBytesType const&>(*m_dataType).numBytes())) << (u256(0x1) << (256 - 8 * dynamic_cast<FixedBytesType const&>(*m_dataType).numBytes()))
<< Instruction::SWAP1 << Instruction::DIV; << Instruction::SWAP1 << Instruction::DIV;
else if ( else
m_dataType->category() == Type::Category::Integer &&
dynamic_cast<IntegerType const&>(*m_dataType).isSigned()
)
// remove the higher order bits // remove the higher order bits
m_context m_context
<< (u256(1) << (8 * (32 - m_dataType->storageBytes()))) << (u256(1) << (8 * (32 - m_dataType->storageBytes())))
@ -242,9 +239,6 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc
<< Instruction::DUP2 << Instruction::DUP2
<< Instruction::MUL << Instruction::MUL
<< Instruction::DIV; << Instruction::DIV;
else if (m_dataType->category() == Type::Category::FixedPoint)
// implementation should be very similar to the integer case.
solAssert(false, "Not yet implemented - FixedPointType.");
m_context << Instruction::MUL << Instruction::OR; m_context << Instruction::MUL << Instruction::OR;
// stack: value storage_ref updated_value // stack: value storage_ref updated_value
m_context << Instruction::SWAP1 << Instruction::SSTORE; m_context << Instruction::SWAP1 << Instruction::SSTORE;