Add endian.h wrapper
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 1 Mar 2012 23:04:47 +0000 (18:04 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 1 Mar 2012 23:04:47 +0000 (18:04 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/Makefile.am
include/babeltrace/endian.h [new file with mode: 0644]
types/float.c

index c1bbf1038231c152bc06c42188aaae9e9af0f7be..24826263aa496d20955f6d47a4fccbb95a74eb7a 100644 (file)
@@ -27,4 +27,5 @@ noinst_HEADERS = \
        babeltrace/ctf/types.h \
        babeltrace/ctf/callbacks-internal.h \
        babeltrace/trace-handle-internal.h \
-       babeltrace/uuid.h
+       babeltrace/uuid.h \
+       babeltrace/endian.h
diff --git a/include/babeltrace/endian.h b/include/babeltrace/endian.h
new file mode 100644 (file)
index 0000000..cadb98a
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef _BABELTRACE_ENDIAN_H
+#define _BABELTRACE_ENDIAN_H
+
+/*
+ * babeltrace/endian.h
+ *
+ * Copyright 2012 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * endian.h compatibility layer.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifdef __linux__
+#include <endian.h>
+#elif defined(__FreeBSD__)
+#include <machine/endian.h>
+#else
+#error "Please add support for your OS."
+#endif
+
+#ifndef FLOAT_WORD_ORDER
+#ifdef __FLOAT_WORD_ORDER
+#define FLOAT_WORD_ORDER       __FLOAT_WORD_ORDER
+#else /* __FLOAT_WORD_ORDER */
+#define FLOAT_WORD_ORDER       BYTE_ORDER
+#endif /* __FLOAT_WORD_ORDER */
+#endif /* FLOAT_WORD_ORDER */
+
+#endif /* _BABELTRACE_ENDIAN_H */
index 7c3295304b3f099aebbbd8b973e043a0b75eb0a5..3e49a4b1fbc7c2c995cb7adc490de0fe49d61d6b 100644 (file)
@@ -21,7 +21,7 @@
 #include <babeltrace/compiler.h>
 #include <babeltrace/format.h>
 #include <babeltrace/types.h>
-#include <endian.h>
+#include <babeltrace/endian.h>
 
 static
 struct definition *_float_definition_new(struct declaration *declaration,
This page took 0.025602 seconds and 4 git commands to generate.