From 7135b6d6dda5c658e5b68ba8c18df776045fa2f5 Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 26 Jul 2008 16:35:58 +0000 Subject: [PATCH] new macros MIN MAX ENSURE --- hostside/common.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hostside/common.h b/hostside/common.h index d0c0a8b..0c9bb41 100644 --- a/hostside/common.h +++ b/hostside/common.h @@ -167,6 +167,13 @@ void nmra_encodeforpic(const Nmra *packet, PicInsn *pi_out); #define CTYPE(isfoobar,ch) (isfoobar((unsigned char)(ch))) #define COMMA , +#define MAX(a_,b_) ({ typeof(a_) a=(a_); typeof(b_) b=(b_); a >= b ? a : b; }) +#define MIN(a_,b_) ({ typeof(a_) a=(a_); typeof(b_) b=(b_); a <= b ? a : b; }) +#define ENSURE(var,rel,value_) do{ \ + typeof(value_) value= (value_); \ + if ((var) rel value) ; else (var)= value; \ + }while(0) + #define STR2(x) #x #define STR(x) STR2(x) -- 2.30.2