summaryrefslogtreecommitdiff
path: root/lib/zebra.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/zebra.h')
-rw-r--r--lib/zebra.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/zebra.h b/lib/zebra.h
index 88f16252..1739d771 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -336,6 +336,23 @@ struct in_pktinfo
#define HAVE_IP_HDRINCL_BSD_ORDER
#endif
+/* Define BYTE_ORDER, if not defined. Useful for compiler conditional
+ * code, rather than preprocessor conditional.
+ * Not all the world has this BSD define.
+ */
+#ifndef BYTE_ORDER
+#define BIG_ENDIAN 4321 /* least-significant byte first (vax, pc) */
+#define LITTLE_ENDIAN 1234 /* most-significant byte first (IBM, net) */
+#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
+
+#if defined(WORDS_BIGENDIAN)
+#define BYTE_ORDER BIG_ENDIAN
+#else /* !WORDS_BIGENDIAN */
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif /* WORDS_BIGENDIAN */
+
+#endif /* ndef BYTE_ORDER */
+
/* MAX / MIN are not commonly defined, but useful */
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))