aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2017-05-23 15:48:26 -0500
committerRob Landley <rob@landley.net>2017-05-23 15:48:26 -0500
commit5a159cceb35fe08e444bd5a1771f8059888b03ff (patch)
treede7fc8d4809d0515e972eb507ca53db27f6b74ee /lib
parent77f9c7700604127f9e9f46d44764ca3db978f706 (diff)
downloadtoybox-5a159cceb35fe08e444bd5a1771f8059888b03ff.tar.gz
Add minof/maxof macros that autodetect type. Make xzcat use them.
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/lib.h b/lib/lib.h
index 5d2bb4df..effba9b4 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -341,5 +341,8 @@ pid_t __attribute__((returns_twice)) xvforkwrap(pid_t pid);
// Wrapper that discards true/false "did it exit" value.
#define NOEXIT(x) WOULD_EXIT(_noexit_res, x)
+#define minof(a, b) ({typeof(a) aa = (a); typeof(b) bb = (b); aa<bb ? aa : bb;})
+#define maxof(a, b) ({typeof(a) aa = (a); typeof(b) bb = (b); aa>bb ? aa : bb;})
+
// Functions in need of further review/cleanup
#include "lib/pending.h"