PUD: move (un)likely macros into compiler.h
authorFerry Huberts <f.huberts@mindef.nl>
Thu, 4 Aug 2011 11:56:41 +0000 (13:56 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Thu, 18 Aug 2011 13:12:24 +0000 (15:12 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/compiler.h [new file with mode: 0644]
lib/pud/src/gpsConversion.c
lib/pud/src/nodeIdConversion.c
lib/pud/src/pud.c
lib/pud/src/pud.h
lib/pud/src/receiver.c
lib/pud/src/wireFormat.c

diff --git a/lib/pud/src/compiler.h b/lib/pud/src/compiler.h
new file mode 100644 (file)
index 0000000..1b426be
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _PUD_COMPILER_H_
+#define _PUD_COMPILER_H_
+
+/** Compiler hint to expect x */
+#ifndef likely
+# if defined(__GNUC__)
+#  define likely(x)                                    __builtin_expect((x),1)
+# else
+#  define likely(x)                                            (x)
+# endif
+#endif
+
+/** Compiler hint to not expect x */
+#ifndef unlikely
+# if defined(__GNUC__)
+#  define unlikely(x)                                  __builtin_expect((x),0)
+# else
+#  define unlikely(x)                                  (x)
+# endif
+#endif
+
+#endif /* _PUD_COMPILER_H_ */
index 21d56b4..5d2c59a 100644 (file)
@@ -5,6 +5,7 @@
 #include "pud.h"
 #include "nodeIdConversion.h"
 #include "configuration.h"
+#include "compiler.h"
 
 /* OLSR includes */
 #include "olsr.h"
index d6b1cef..4834b5f 100644 (file)
@@ -4,6 +4,7 @@
 #include "pud.h"
 #include "configuration.h"
 #include "networkInterfaces.h"
+#include "compiler.h"
 
 /* OLSR includes */
 
index 88d0d83..2daacfd 100644 (file)
@@ -7,6 +7,7 @@
 #include "gpsConversion.h"
 #include "receiver.h"
 #include "dedup.h"
+#include "compiler.h"
 
 /* OLSRD includes */
 #include "ipcalc.h"
index 5e5d15d..f234be8 100644 (file)
  * Global
  */
 
-/** Compiler hint to expect x */
-#ifndef likely
-# if defined(__GNUC__)
-#  define likely(x)                                    __builtin_expect((x),1)
-# else
-#  define likely(x)                                            (x)
-# endif
-#endif
-
-/** Compiler hint to not expect x */
-#ifndef unlikely
-# if defined(__GNUC__)
-#  define unlikely(x)                                  __builtin_expect((x),0)
-# else
-#  define unlikely(x)                                  (x)
-# endif
-#endif
-
 /** The long plugin name */
 #define PUD_PLUGIN_NAME_LONG                   "OLSRD Position Update Distribution (PUD) plugin"
 
index 5e73ea5..ee10fa2 100644 (file)
@@ -8,6 +8,7 @@
 #include "timers.h"
 #include "posAvg.h"
 #include "networkInterfaces.h"
+#include "compiler.h"
 
 /* OLSRD includes */
 #include "net_olsr.h"
index e86d181..8956597 100644 (file)
@@ -1,7 +1,7 @@
 #include "wireFormat.h"
 
 /* Plugin includes */
-#include "pud.h"
+#include "compiler.h"
 
 /* System includes */
 #include <stdlib.h>