3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-25 10:05:32 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-06-03 19:50:25 -07:00 committed by Nuno Lopes
parent 2788f72bbb
commit 9262908ebb
30 changed files with 191 additions and 341 deletions

View file

@ -20,12 +20,12 @@ Revision History:
#define MPZ_H_
#include<string>
#include<mutex>
#include "util/util.h"
#include "util/small_object_allocator.h"
#include "util/trace.h"
#include "util/scoped_numeral.h"
#include "util/scoped_numeral_vector.h"
#include "util/z3_omp.h"
#include "util/mpn.h"
unsigned u_gcd(unsigned u, unsigned v);
@ -135,9 +135,9 @@ inline void swap(mpz & m1, mpz & m2) { m1.swap(m2); }
template<bool SYNCH = true>
class mpz_manager {
mutable small_object_allocator m_allocator;
mutable omp_nest_lock_t m_lock;
#define MPZ_BEGIN_CRITICAL() if (SYNCH) omp_set_nest_lock(&m_lock);
#define MPZ_END_CRITICAL() if (SYNCH) omp_unset_nest_lock(&m_lock);
mutable std::recursive_mutex m_lock;
#define MPZ_BEGIN_CRITICAL() if (SYNCH) m_lock.lock();
#define MPZ_END_CRITICAL() if (SYNCH) m_lock.unlock();
mutable mpn_manager m_mpn_manager;
#ifndef _MP_GMP
@ -702,11 +702,7 @@ public:
bool decompose(mpz const & n, svector<digit_t> & digits);
};
#ifndef _NO_OMP_
typedef mpz_manager<true> synch_mpz_manager;
#else
typedef mpz_manager<false> synch_mpz_manager;
#endif
typedef mpz_manager<false> unsynch_mpz_manager;
typedef _scoped_numeral<unsynch_mpz_manager> scoped_mpz;