diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 22:50:46 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 22:50:46 +0800 |
commit | 0be58595036d3411124bc8b39f9d151790d950b4 (patch) | |
tree | ccced0d20f57afad4f85c4bf46caee72c56fb173 /libsolidity | |
parent | 548b7ce42d1650d18ce71c3d11486ab4d27e6c0f (diff) | |
download | dexon-solidity-0be58595036d3411124bc8b39f9d151790d950b4.tar.gz dexon-solidity-0be58595036d3411124bc8b39f9d151790d950b4.tar.zst dexon-solidity-0be58595036d3411124bc8b39f9d151790d950b4.zip |
codegen: cleanup values to fit in storage bytes
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/codegen/CompilerUtils.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 41559a42..d5361ac6 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -738,6 +738,10 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp default: // All other types should not be convertible to non-equal types. solAssert(_typeOnStack == _targetType, "Invalid type conversion requested."); + if (_cleanupNeeded && _targetType.canBeStored() && _targetType.storageBytes() < 32) + m_context + << ((u256(1) << (8 * _targetType.storageBytes())) - 1) + << Instruction::AND; break; } |