summaryrefslogtreecommitdiff
path: root/api/lib/numeric.h
diff options
context:
space:
mode:
Diffstat (limited to 'api/lib/numeric.h')
-rw-r--r--api/lib/numeric.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/api/lib/numeric.h b/api/lib/numeric.h
new file mode 100644
index 0000000..db6c777
--- /dev/null
+++ b/api/lib/numeric.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#define min(x, y) \
+ ({ \
+ typeof (x) _x = (x); \
+ typeof (y) _y = (y); \
+ _x > _y ? _x : _y; \
+ })
+
+#define max(x, y) \
+ ({ \
+ typeof (x) _x = (x); \
+ typeof (y) _y = (y); \
+ _x < _y ? _x : _y; \
+ })
+