From d618f688d53e1df0ac31a275ae8541dc56f283ed Mon Sep 17 00:00:00 2001 From: Jon Cruz Date: Mon, 15 Jun 2015 15:37:09 -0700 Subject: Moved the MIN() macro to the helper include. Removed multiple definitions of the MIN() macro from existing locations and unified with a single definition. Updated sources to use the shared version. Signed-off-by: Jon A. Cruz Reviewed-by: Peter Hutterer Reviewed-by: Bryce Harrington --- shared/helpers.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'shared') diff --git a/shared/helpers.h b/shared/helpers.h index 7502ff32..83f79b11 100644 --- a/shared/helpers.h +++ b/shared/helpers.h @@ -41,6 +41,17 @@ extern "C" { #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) #endif +/** + * Returns the smaller of two values. + * + * @param x the first item to compare. + * @param y the second item to compare. + * @return the value that evaluates to lesser than the other. + */ +#ifndef MIN +#define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#endif + #ifdef __cplusplus } #endif -- cgit v1.2.1