Bitwise operators: AND, OR, XOR

This commit is contained in:
Paweł Bylica 2014-10-02 15:03:59 +02:00
parent c002d9b843
commit 48897f42c8

View file

@ -315,6 +315,33 @@ std::unique_ptr<llvm::Module> Compiler::compile(const dev::bytes& bytecode)
stack.push(result);
break;
}
case Instruction::AND:
{
auto lhs = stack.pop();
auto rhs = stack.pop();
auto res = builder.CreateAnd(lhs, rhs);
stack.push(res);
break;
}
case Instruction::OR:
{
auto lhs = stack.pop();
auto rhs = stack.pop();
auto res = builder.CreateOr(lhs, rhs);
stack.push(res);
break;
}
case Instruction::XOR:
{
auto lhs = stack.pop();
auto rhs = stack.pop();
auto res = builder.CreateXor(lhs, rhs);
stack.push(res);
break;
}
case Instruction::POP:
{