Replace common pattern by new LIMIT_TO()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-01-14 22:34:05 +01:00
parent aa870f5d91
commit 726b9380d1
11 changed files with 73 additions and 162 deletions

View file

@ -29,6 +29,7 @@
*
* Known contributors to this file:
* Doug Hay, 1998
* Markus Armbruster, 2004-2013
*/
#ifndef MISC_H
@ -37,6 +38,9 @@
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define LIMIT_TO(val, min, max) \
((val) < (min) ? (min) : (val) > (max) ? (max) : (val))
#ifdef _WIN32
#include "w32misc.h"
#endif /* _WIN32 */