ifndef MIN, MAX and CLAMP

Does make live a lot easier for backends.
This commit is contained in:
richi 2016-01-20 12:35:31 +01:00
parent ba9ca057f2
commit aa64398646

View File

@ -1,8 +1,14 @@
#include "limits.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) < (b) ? (b) : (a))
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
#ifndef CLAMP
#define CLAMP(i,v,x) (MAX(MIN(v,x), i))
#endif
#define LEN(a) (sizeof(a)/sizeof(a)[0])
#define UNUSED(a) ((void)(a))