From a91a2e773926b7bf62970d8593cdc3c55a42da19 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sun, 30 Sep 2018 17:36:34 +0200 Subject: [PATCH] gamemode: Add a value clamping helper Signed-off-by: Kai Krakow --- daemon/gamemode.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/gamemode.c b/daemon/gamemode.c index aeca940..a299cf2 100644 --- a/daemon/gamemode.c +++ b/daemon/gamemode.c @@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include #include #include @@ -59,6 +60,10 @@ POSSIBILITY OF SUCH DAMAGE. */ #define NICE_DEFAULT_PRIORITY -4 +/* Value clamping helper. + */ +#define CLAMP(lbound, ubound, value) MIN(MIN(lbound, ubound), MAX(MAX(lbound, ubound), value)) + /** * The GameModeClient encapsulates the remote connection, providing a list * form to contain the pid and credentials.