/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* * Main authors: * Jip J. Dekker * Guido Tack */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ namespace MiniZinc { inline std::pair Interpreter::cse_find(int proc, const CSEKey& key, BytecodeProc::Mode& mode) { std::pair result; DTRACE2(CSE_FIND_START, (uintptr_t)this, _procs[proc].nargs); switch (_procs[proc].nargs) { case 1: { auto fkey = static_cast&>(key); auto table = static_cast>*>(cse[proc]); result = table->find(*this, fkey, mode); break; } case 2: { auto fkey = static_cast&>(key); auto table = static_cast>*>(cse[proc]); result = table->find(*this, fkey, mode); break; } case 3: { auto fkey = static_cast&>(key); auto table = static_cast>*>(cse[proc]); result = table->find(*this, fkey, mode); break; } case 4: { auto fkey = static_cast&>(key); auto table = static_cast>*>(cse[proc]); result = table->find(*this, fkey, mode); break; } default: { auto vkey = static_cast(key); auto table = static_cast*>(cse[proc]); result = table->find(*this, vkey, mode); break; } } DTRACE2(CSE_FIND_END, (uintptr_t)this, result.second); return result; } inline void Interpreter::cse_insert(int proc, CSEKey& key, BytecodeProc::Mode& mode, Val& val) { DTRACE2(CSE_INSERT_START, (uintptr_t)this, _procs[proc].nargs); switch (_procs[proc].nargs) { case 1: { auto fkey = static_cast&>(key); auto table = static_cast>*>(cse[proc]); table->insert(*this, fkey, mode, val); break; } case 2: { auto fkey = static_cast&>(key); auto table = static_cast>*>(cse[proc]); table->insert(*this, fkey, mode, val); break; } case 3: { auto fkey = static_cast&>(key); auto table = static_cast>*>(cse[proc]); table->insert(*this, fkey, mode, val); break; } case 4: { auto fkey = static_cast&>(key); auto table = static_cast>*>(cse[proc]); table->insert(*this, fkey, mode, val); break; } default: { auto vkey = static_cast(key); auto table = static_cast*>(cse[proc]); table->insert(*this, vkey, mode, val); break; } } DTRACE1(CSE_INSERT_END, (uintptr_t)this); } } // namespace MiniZinc