1
0
ithewei 6 жил өмнө
parent
commit
85ac09c357
1 өөрчлөгдсөн 4 нэмэгдсэн , 0 устгасан
  1. 4 0
      hdef.h

+ 4 - 0
hdef.h

@@ -107,6 +107,10 @@ typedef std::map<std::string, std::string> keyval_t;
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif
 #endif
 
 
+#ifndef LIMIT
+#define LIMIT(lower, v, upper) MIN(MAX((lower), (v)), (upper))
+#endif
+
 #ifndef ARRAY_SIZE
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
 #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
 #endif
 #endif