From d54d0a248b4d24092ba2d2ed1824406d14367053 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 20 Feb 2001 17:51:24 +0000 Subject: [PATCH] Added a useful macro for value clamping. --- lib/index.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/index.h b/lib/index.h index e4182c7c..017cf7b2 100644 --- a/lib/index.h +++ b/lib/index.h @@ -4,6 +4,8 @@ * (c) 2001 Martin Mares */ +#define CLAMP(x,min,max) ({ int _t=x; (_t < min) ? min : (_t > max) ? max : _t; }) + /* Words */ #define MAX_WORD_LEN 64 -- 2.39.2