diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-11-22 00:07:10 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 22:45:16 +0800 |
commit | ea628001d5f34ee1d85398a17f93e7c4f55429fe (patch) | |
tree | b1944bbd5938cc56d8fee290ca2817ccf4c58f6f /libsolidity/codegen/LValue.cpp | |
parent | 56d664108614fa8fdf63a02d8f605bf5afcd0837 (diff) | |
download | dexon-solidity-ea628001d5f34ee1d85398a17f93e7c4f55429fe.tar.gz dexon-solidity-ea628001d5f34ee1d85398a17f93e7c4f55429fe.tar.zst dexon-solidity-ea628001d5f34ee1d85398a17f93e7c4f55429fe.zip |
codegen: add an option to CovertType so that it can truncate sign bits
Diffstat (limited to 'libsolidity/codegen/LValue.cpp')
-rw-r--r-- | libsolidity/codegen/LValue.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp index 78854588..df74e836 100644 --- a/libsolidity/codegen/LValue.cpp +++ b/libsolidity/codegen/LValue.cpp @@ -234,7 +234,7 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc m_context << Instruction::SWAP1; utils.convertType(_sourceType, _sourceType, true); - utils.convertType(*m_dataType, *m_dataType, true); + utils.convertType(*m_dataType, *m_dataType, true, true); m_context << Instruction::SWAP1; m_context << Instruction::SSTORE; @@ -280,13 +280,7 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc { solAssert(m_dataType->sizeOnStack() == 1, "Invalid stack size for opaque type."); // remove the higher order bits - utils.convertType(*m_dataType, *m_dataType, true); - m_context - << (u256(1) << (8 * (32 - m_dataType->storageBytes()))) - << Instruction::SWAP1 - << Instruction::DUP2 - << Instruction::MUL - << Instruction::DIV; + utils.convertType(*m_dataType, *m_dataType, true, true); } m_context << Instruction::MUL << Instruction::OR; // stack: value storage_ref updated_value |