mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adjustments for the NEG->BNOT change.
This commit is contained in:
parent
2541a403c3
commit
f91ddc2788
13
Compiler.cpp
13
Compiler.cpp
@ -107,13 +107,7 @@ void ExpressionCompiler::endVisit(UnaryOperation& _unaryOperation)
|
|||||||
append(eth::Instruction::NOT);
|
append(eth::Instruction::NOT);
|
||||||
break;
|
break;
|
||||||
case Token::BIT_NOT: // ~
|
case Token::BIT_NOT: // ~
|
||||||
// ~a modeled as "a xor (0 - 1)" for now
|
append(eth::Instruction::BNOT);
|
||||||
append(eth::Instruction::PUSH1);
|
|
||||||
append(1);
|
|
||||||
append(eth::Instruction::PUSH1);
|
|
||||||
append(0);
|
|
||||||
append(eth::Instruction::SUB);
|
|
||||||
append(eth::Instruction::XOR);
|
|
||||||
break;
|
break;
|
||||||
case Token::DELETE: // delete
|
case Token::DELETE: // delete
|
||||||
// a -> a xor a (= 0).
|
// a -> a xor a (= 0).
|
||||||
@ -145,7 +139,10 @@ void ExpressionCompiler::endVisit(UnaryOperation& _unaryOperation)
|
|||||||
// unary add, so basically no-op
|
// unary add, so basically no-op
|
||||||
break;
|
break;
|
||||||
case Token::SUB: // -
|
case Token::SUB: // -
|
||||||
append(eth::Instruction::NEG);
|
// unary -x translates into "0-x"
|
||||||
|
append(eth::Instruction::PUSH1);
|
||||||
|
append(0);
|
||||||
|
append(eth::Instruction::SUB);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false); // invalid operation
|
assert(false); // invalid operation
|
||||||
|
Loading…
Reference in New Issue
Block a user