aboutsummaryrefslogtreecommitdiff
path: root/src/utils/utils.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-05-16 15:02:43 +0800
committerchai <chaifix@163.com>2018-05-16 15:02:43 +0800
commitfdaf0e7eb6b9d9bdd7d5ab5f814f4ebbf791ff67 (patch)
tree6b9712381d6bce07554491acf900ec4b27e6ecb0 /src/utils/utils.h
v0.1.0
Diffstat (limited to 'src/utils/utils.h')
-rw-r--r--src/utils/utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils/utils.h b/src/utils/utils.h
new file mode 100644
index 0000000..f1a340b
--- /dev/null
+++ b/src/utils/utils.h
@@ -0,0 +1,11 @@
+#ifndef __JIN_UTILS_H
+#define __JIN_UTILS_H
+
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#define clamp(a, mi,ma) min(max(a,mi),ma)
+
+#define within(a,min,max) (a >= min && a <= max)
+#define without(a,min,max) (a < min || a > max)
+
+#endif \ No newline at end of file