From: Martin Mares Date: Tue, 20 Feb 2001 17:51:24 +0000 (+0000) Subject: Added a useful macro for value clamping. X-Git-Tag: holmes-import~1545 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=d54d0a248b4d24092ba2d2ed1824406d14367053;p=libucw.git Added a useful macro for value clamping. --- 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