summaryrefslogtreecommitdiff
path: root/lib/birdlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/birdlib.h')
-rw-r--r--lib/birdlib.h25
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/birdlib.h b/lib/birdlib.h
index 37337078..ddc963f4 100644
--- a/lib/birdlib.h
+++ b/lib/birdlib.h
@@ -9,8 +9,8 @@
#ifndef _BIRD_BIRDLIB_H_
#define _BIRD_BIRDLIB_H_
-#include "timer.h"
-#include "alloca.h"
+#include "sysdep/unix/timer.h"
+#include "lib/alloca.h"
/* Ugly structure offset handling macros */
@@ -34,6 +34,13 @@
#define ABS(a) ((a)>=0 ? (a) : -(a))
#define DELTA(a,b) (((a)>=(b))?(a)-(b):(b)-(a))
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
+#define CALL(fn, args...) ({ if (fn) fn(args); })
+
+static inline int uint_cmp(uint i1, uint i2)
+{ return (int)(i1 > i2) - (int)(i1 < i2); }
+
+static inline int u64_cmp(u64 i1, u64 i2)
+{ return (int)(i1 > i2) - (int)(i1 < i2); }
/* Bitfield macros */
@@ -49,12 +56,6 @@
#define NULL ((void *) 0)
#endif
-#ifndef IPV6
-#define IP_VERSION 4
-#else
-#define IP_VERSION 6
-#endif
-
/* Macros for gcc attributes */
@@ -62,14 +63,6 @@
#define UNUSED __attribute__((unused))
#define PACKED __attribute__((packed))
-#ifdef IPV6
-#define UNUSED4
-#define UNUSED6 UNUSED
-#else
-#define UNUSED4 UNUSED
-#define UNUSED6
-#endif
-
/* Microsecond time */
typedef s64 btime;