mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
NEG->BNOT change
This commit is contained in:
parent
413b315a03
commit
01224287f5
12
Compiler.cpp
12
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
|
||||
|
Loading…
Reference in New Issue
Block a user