summaryrefslogtreecommitdiffstats
path: root/lib/compiler.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-07-28 09:24:00 +0200
committerDavid Lamparter <equinox@diac24.net>2019-07-28 09:25:58 +0200
commit1315d74de97be2944d7b005b2f9a50e9ae5eff4d (patch)
treea229abff3b9f212c83875619f3402dd5004cdd15 /lib/compiler.h
parentMerge pull request #4730 from idryzhov/fix (diff)
downloadfrr-1315d74de97be2944d7b005b2f9a50e9ae5eff4d.tar.xz
frr-1315d74de97be2944d7b005b2f9a50e9ae5eff4d.zip
lib: fix prefix_cmp() return values
OMGWTFBBQ Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/compiler.h')
-rw-r--r--lib/compiler.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/compiler.h b/lib/compiler.h
index 7c7f4ce29..6700ca9e8 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)