1 #ifndef LIBNAGIOS_NSUTILS_H_INCLUDED
2 #define LIBNAGIOS_NSUTILS_H_INCLUDED
24 #define alloc_nr(x) (((x)+16)*3/2)
31 static inline int nsu_ispow2(
unsigned int x)
33 return x > 1 ? !(x & (x - 1)) : 0;
43 static inline unsigned int rup2pof2(
unsigned int r)
64 static inline unsigned int ranged_urand(
unsigned int low,
unsigned int high)
66 return low + (rand() * (1.0 / (RAND_MAX + 1.0)) * (high - low));
91 extern const char *
mkstr(
const char *fmt, ...)
92 __attribute__((__format__(__printf__, 1, 2)));
100 extern
int tv_delta_msec(const struct timeval *start, const struct timeval *stop);
109 extern
float tv_delta_f(const struct timeval *start, const struct timeval *stop);