13 #ifndef SATSOLVER_UTIL_H
14 #define SATSOLVER_UTIL_H
29 extern void sat_oom(
size_t,
size_t);
30 extern unsigned int sat_timems(
unsigned int subtract);
31 extern void sat_sort(
void *base,
size_t nmemb,
size_t size,
int (*
compar)(
const void *,
const void *,
void *),
void *
compard);
32 extern char *
sat_dupjoin(
const char *str1,
const char *str2,
const char *str3);
33 extern char *
sat_dupappend(
const char *str1,
const char *str2,
const char *str3);
34 extern int sat_hex2bin(
const char **strp,
unsigned char *buf,
int bufl);
35 extern char *
sat_bin2hex(
const unsigned char *buf,
int l,
char *str);
38 static inline void *
sat_extend(
void *buf,
size_t len,
size_t nmemb,
size_t size,
size_t block)
42 if ((len & block) == 0)
47 if (((len - 1) | block) != ((len + nmemb - 1) | block))
48 buf =
sat_realloc2(buf, (len + (nmemb + block)) & ~block, size);
61 static inline void *
sat_zextend(
void *buf,
size_t len,
size_t nmemb,
size_t size,
size_t block)
63 buf =
sat_extend(buf, len, nmemb, size, block);
64 memset((
char *)buf + len * size, 0, nmemb * size);
81 memset(buf, 0, ((len + block) & ~block) * size);