diff options
Diffstat (limited to 'built_in.h')
-rw-r--r-- | built_in.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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 |