aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-10-29 07:29:07 +0800
committerChristian <c@ethdev.com>2014-10-29 21:26:37 +0800
commit01224287f5e24f7074f398ac9b064b27b2c3877e (patch)
treefd12d1783bbb449d64fadf506465a64f15842893
parent413b315a037540b9919d2ca7cef67369041b26d0 (diff)
downloaddexon-solidity-01224287f5e24f7074f398ac9b064b27b2c3877e.tar
dexon-solidity-01224287f5e24f7074f398ac9b064b27b2c3877e.tar.gz
dexon-solidity-01224287f5e24f7074f398ac9b064b27b2c3877e.tar.bz2
dexon-solidity-01224287f5e24f7074f398ac9b064b27b2c3877e.tar.lz
dexon-solidity-01224287f5e24f7074f398ac9b064b27b2c3877e.tar.xz
dexon-solidity-01224287f5e24f7074f398ac9b064b27b2c3877e.tar.zst
dexon-solidity-01224287f5e24f7074f398ac9b064b27b2c3877e.zip
NEG->BNOT change
-rw-r--r--Compiler.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/Compiler.cpp b/Compiler.cpp
index acb0a5cc..4244a3e0 100644
--- a/Compiler.cpp
+++ b/Compiler.cpp
@@ -111,13 +111,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).
@@ -149,7 +143,9 @@ void ExpressionCompiler::endVisit(UnaryOperation& _unaryOperation)
// unary add, so basically no-op
break;
case Token::SUB: // -
- append(eth::Instruction::NEG);
+ append(eth::Instruction::PUSH1);
+ append(0);
+ append(eth::Instruction::SUB);
break;
default:
assert(false); // invalid operation