1#ifndef _util_hpp_INCLUDED
2#define _util_hpp_INCLUDED
20inline double relative (
double a,
double b) {
return b ? a / b : 0; }
27bool has_suffix (
const char *str,
const char *suffix);
28bool has_prefix (
const char *str,
const char *prefix);
49inline bool contained (int64_t c, int64_t l, int64_t u) {
50 return l <= c && c <= u;
53inline bool aligned (
size_t n,
size_t alignment) {
55 const size_t mask = alignment - 1;
59inline size_t align (
size_t n,
size_t alignment) {
62 const size_t mask = alignment - 1;
64 res = (res | mask) + 1;
92 std::vector<T> ().swap (v);
102 if (v.capacity () > v.size ()) {
103 std::vector<T> (v).swap (v);
109static void enlarge_init (
vector<T> &v,
size_t N,
const T &i) {
114template <
class T>
static void enlarge_only (
vector<T> &v,
size_t N) {
119template <
class T>
static void enlarge_zero (
vector<T> &v,
size_t N) {
120 enlarge_init (v, N, (
const T &) 0);
149template <
class T>
inline void clear_n (T *base,
size_t n) {
150 memset (base, 0,
sizeof (T) * n);
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
#define CADICAL_assert(ignore)
bool has_suffix(const char *str, const char *suffix)
bool is_color_option(const char *arg)
bool is_power_of_two(unsigned n)
double relative(double a, double b)
void shrink_vector(std::vector< T > &v)
bool aligned(size_t n, size_t alignment)
bool parse_int_str(const char *val_str, int &val)
bool has_prefix(const char *str, const char *prefix)
size_t align(size_t n, size_t alignment)
void clear_n(T *base, size_t n)
bool contained(int64_t c, int64_t l, int64_t u)
uint64_t hash_string(const char *str)
void erase_vector(std::vector< T > &v)
bool is_no_color_option(const char *arg)
double percent(double a, double b)