1 #ifndef UTIL_H
2 #define UTIL_H
3 
4 #include <stdlib.h>
5 
6 #ifdef RAND
7 #undef RAND
8 #endif
9 #define RAND(lb, ub) (rand() % ((ub) - (lb) + 1) + (lb))
10 
11 #ifdef MAX
12 #undef MAX
13 #endif
14 #define MAX(x, y) ((x) > (y) ? (x) : (y))
15 
16 #ifdef MIN
17 #undef MIN
18 #endif
19 #define MIN(x, y) ((x) < (y) ? (x) : (y))
20 
21 #ifdef UNUSED
22 #undef UNUSED
23 #endif
24 #define UNUSED(x) (void)(x)
25 
26 void *xalloc(int size);
27 void fatal(const char *format, ...);
28 
29 #endif
30