diff options
Diffstat (limited to 'lib/compiler.h')
-rw-r--r-- | lib/compiler.h | 7 |
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) |