diff options
author | Christian <c@ethdev.com> | 2014-10-29 00:09:06 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-29 00:09:06 +0800 |
commit | f91ddc27889fd0565179bcac44ff8b7d0413cf20 (patch) | |
tree | 1401b6b1a0b3ed62094ded0e72dd91c7486e8960 /Compiler.cpp | |
parent | 2541a403c31ea59738c8f6f1ac0779ace287c77f (diff) | |
download | dexon-solidity-f91ddc27889fd0565179bcac44ff8b7d0413cf20.tar dexon-solidity-f91ddc27889fd0565179bcac44ff8b7d0413cf20.tar.gz dexon-solidity-f91ddc27889fd0565179bcac44ff8b7d0413cf20.tar.bz2 dexon-solidity-f91ddc27889fd0565179bcac44ff8b7d0413cf20.tar.lz dexon-solidity-f91ddc27889fd0565179bcac44ff8b7d0413cf20.tar.xz dexon-solidity-f91ddc27889fd0565179bcac44ff8b7d0413cf20.tar.zst dexon-solidity-f91ddc27889fd0565179bcac44ff8b7d0413cf20.zip |
Adjustments for the NEG->BNOT change.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r-- | Compiler.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index ef568013..43cbc462 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -107,13 +107,7 @@ void ExpressionCompiler::endVisit(UnaryOperation& _unaryOperation) append(eth::Instruction::NOT); break; case Token::BIT_NOT: // ~ - // ~a modeled as "a xor (0 - 1)" for now - append(eth::Instruction::PUSH1); - append(1); - append(eth::Instruction::PUSH1); - append(0); - append(eth::Instruction::SUB); - append(eth::Instruction::XOR); + append(eth::Instruction::BNOT); break; case Token::DELETE: // delete // a -> a xor a (= 0). @@ -145,7 +139,10 @@ void ExpressionCompiler::endVisit(UnaryOperation& _unaryOperation) // unary add, so basically no-op break; case Token::SUB: // - - append(eth::Instruction::NEG); + // unary -x translates into "0-x" + append(eth::Instruction::PUSH1); + append(0); + append(eth::Instruction::SUB); break; default: assert(false); // invalid operation |