diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 00:03:17 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 22:45:18 +0800 |
commit | fa486f5b44790e5abda28ddb2b798d0b1408269f (patch) | |
tree | 8ca2833624d3c8c464ea5a21249f80aafd5e1a4b | |
parent | 9d25b5601e6e2713e14803777390c2d45be3d51c (diff) | |
download | dexon-solidity-fa486f5b44790e5abda28ddb2b798d0b1408269f.tar.gz dexon-solidity-fa486f5b44790e5abda28ddb2b798d0b1408269f.tar.zst dexon-solidity-fa486f5b44790e5abda28ddb2b798d0b1408269f.zip |
codegen: shorten the bit truncation
-rw-r--r-- | libsolidity/codegen/CompilerUtils.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 21dd2840..41559a42 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -492,11 +492,8 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp { if (typeOnStack.numBits() < 256) m_context - << (u256(1) << (256 - typeOnStack.numBits())) - << Instruction::SWAP1 - << Instruction::DUP2 - << Instruction::MUL - << Instruction::DIV; + << ((u256(1) << typeOnStack.numBits()) - 1) + << Instruction::AND; chopSignBitsPending = false; } } |