diff options
Diffstat (limited to 'src/sat/satoko/utils/misc.h')
-rwxr-xr-x | src/sat/satoko/utils/misc.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/sat/satoko/utils/misc.h b/src/sat/satoko/utils/misc.h new file mode 100755 index 00000000..aa8bcb8c --- /dev/null +++ b/src/sat/satoko/utils/misc.h @@ -0,0 +1,37 @@ +//===--- 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 <stdint.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 */ |