summaryrefslogtreecommitdiffstats
path: root/src/sat/satoko/utils/misc.h
blob: 481e23b7179c9b575fb426e597d94cf0dadd364a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//===--- misc.h -------------------------------------------------------------===
//
//                     satoko: Satisfiability solver
//
// This file is distributed under the BSD 2-Clause License.
// See LICENSE for details.
//
//===------------------------------------------------------------------------===
#ifndef satoko__utils__misc_h
#define satoko__utils__misc_h

#include "misc/util/abc_global.h"
ABC_NAMESPACE_HEADER_START

#define mkt_swap(type, a, b)  { type t = a; a = b; b = t; }

static inline unsigned mkt_uint_max(unsigned a, unsigned b)
{
    return a > b ?  a : b;
}

static inline int mkt_uint_compare(const void *p1, const void *p2)
{
    const unsigned pp1 = *(const unsigned *)p1;
    const unsigned pp2 = *(const unsigned *)p2;

    if (pp1 < pp2)
        return -1;
    if (pp1 > pp2)
        return 1;
    return 0;
}

ABC_NAMESPACE_HEADER_END
#endif /* satoko__utils__misc_h */