summaryrefslogtreecommitdiff
path: root/api/lib/numeric.h
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2023-02-05 12:51:06 +0000
committerAda Christine <adachristine18@gmail.com>2023-02-05 12:51:06 +0000
commit0bfbbabeed6b53d7aa44f6df9b569e3bacb040e9 (patch)
tree96c50e4354c2f5cc2f9c4c4b7689c7d5cf31212c /api/lib/numeric.h
parent05223a4bf6a3927ac638617d2e85bf3d0a348cb2 (diff)
remove stale header, add numeric.h, use min
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; \
+ })
+