From 1315d74de97be2944d7b005b2f9a50e9ae5eff4d Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 28 Jul 2019 09:24:00 +0200 Subject: lib: fix prefix_cmp() return values OMGWTFBBQ Signed-off-by: David Lamparter --- lib/compiler.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/compiler.h') diff --git a/lib/compiler.h b/lib/compiler.h index 7c7f4ce294..6700ca9e8b 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -165,6 +165,13 @@ extern "C" { _min_a < _min_b ? _min_a : _min_b; \ }) +#define numcmp(a, b) \ + ({ \ + typeof(a) _cmp_a = (a); \ + typeof(b) _cmp_b = (b); \ + (_cmp_a < _cmp_b) ? -1 : ((_cmp_a > _cmp_b) ? 1 : 0); \ + }) + #ifndef offsetof #ifdef __compiler_offsetof #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE,MEMBER) -- cgit v1.2.3