Added max and min macros.
authorFredrik Tolf <fredrik@dolda2000.com>
Wed, 17 Dec 2008 02:05:58 +0000 (03:05 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Wed, 17 Dec 2008 02:05:58 +0000 (03:05 +0100)
lib/utils.h

index 4f85743..6b1df4e 100644 (file)
@@ -3,6 +3,9 @@
 
 #include <stdarg.h>
 
+#define max(a, b) (((b) > (a))?(b):(a))
+#define min(a, b) (((b) < (a))?(b):(a))
+
 #define smalloc(size) ({void *__result__; ((__result__ = malloc(size)) == NULL)?({exit(-1); (void *)0;}):__result__;})
 #define srealloc(ptr, size) ({void *__result__; ((__result__ = realloc((ptr), (size))) == NULL)?({exit(-1); (void *)0;}):__result__;})
 #define szmalloc(size) memset(smalloc(size), 0, size)