summaryrefslogtreecommitdiff
path: root/built_in.h
diff options
context:
space:
mode:
Diffstat (limited to 'built_in.h')
-rw-r--r--built_in.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/built_in.h b/built_in.h
index 9f70561..6f6625e 100644
--- a/built_in.h
+++ b/built_in.h
@@ -109,6 +109,15 @@ typedef uint8_t u8;
})
#endif /* max */
+#ifndef max_t
+# define max_t(type, a, b) \
+ ({ \
+ type ___max1 = (a); \
+ type ___max2 = (b); \
+ ___max1 > ___max2 ? ___max1 : ___max2; \
+ })
+#endif /* max_t */
+
#ifndef min
# define min(a, b) \
({ \
@@ -118,6 +127,15 @@ typedef uint8_t u8;
})
#endif /* min */
+#ifndef min_t
+# define min_t(type, a, b) \
+ ({ \
+ type ___min1 = (a); \
+ type ___min2 = (b); \
+ ___min1 < ___min2 ? ___min1 : ___min2; \
+ })
+#endif /* min_t */
+
#ifndef ispow2
# define ispow2(x) ({ !!((x) && !((x) & ((x) - 1))); })
#endif