misc.h 906 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//===--- 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

15
#define stk_swap(type, a, b)  { type t = a; a = b; b = t; }
16

17
static inline unsigned stk_uint_max(unsigned a, unsigned b)
18 19 20 21
{
    return a > b ?  a : b;
}

22
static inline int stk_uint_compare(const void *p1, const void *p2)
23 24 25 26 27 28 29 30 31 32 33 34 35
{
    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 */