From 0cf8d022ae7d2e2da347347fdc76ba9529149c35 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 18 Nov 2015 17:12:39 +0100 Subject: Addmod and mulmod. --- libsolidity/codegen/ExpressionCompiler.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libsolidity/codegen') diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 3906a897..0f952f9c 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -637,6 +637,20 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) m_context << eth::Instruction::BLOCKHASH; break; } + case Location::AddMod: + case Location::MulMod: + { + for (unsigned i = 0; i < 3; i ++) + { + arguments[2 - i]->accept(*this); + utils().convertType(*arguments[2 - i]->annotation().type, IntegerType(256)); + } + if (function.location() == Location::AddMod) + m_context << eth::Instruction::ADDMOD; + else + m_context << eth::Instruction::MULMOD; + break; + } case Location::ECRecover: case Location::SHA256: case Location::RIPEMD160: -- cgit