util: add min/max macros
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 6 Feb 2014 05:26:02 +0000 (15:26 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 17 Feb 2014 04:35:06 +0000 (14:35 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/libinput-util.h

index 381a0d4423da7b1ed17e362e65d733c2245e4bb7..2fbce72f2902061cc301d237eb454761d9ba9159 100644 (file)
@@ -73,6 +73,9 @@ int list_empty(const struct list *list);
 #define ARRAY_FOR_EACH(_arr, _elem) \
        for (int i = 0; (_elem = &_arr[i]) && i < ARRAY_LENGTH(_arr); i++)
 
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#define max(a, b) (((a) > (b)) ? (a) : (b))
+
 /*
  * This fixed point implementation is a verbatim copy from wayland-util.h from
  * the Wayland project, with the wl_ prefix renamed li_.