From dd6f7e0fae723d0a15c60436c0d6c4d7a123cdf6 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 1 Mar 2012 18:04:47 -0500 Subject: [PATCH] Add endian.h wrapper Signed-off-by: Mathieu Desnoyers --- include/Makefile.am | 3 ++- include/babeltrace/endian.h | 37 +++++++++++++++++++++++++++++++++++++ types/float.c | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 include/babeltrace/endian.h diff --git a/include/Makefile.am b/include/Makefile.am index c1bbf103..24826263 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -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 index 00000000..cadb98ae --- /dev/null +++ b/include/babeltrace/endian.h @@ -0,0 +1,37 @@ +#ifndef _BABELTRACE_ENDIAN_H +#define _BABELTRACE_ENDIAN_H + +/* + * babeltrace/endian.h + * + * Copyright 2012 (c) - Mathieu Desnoyers + * + * 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 +#elif defined(__FreeBSD__) +#include +#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 */ diff --git a/types/float.c b/types/float.c index 7c329530..3e49a4b1 100644 --- a/types/float.c +++ b/types/float.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include static struct definition *_float_definition_new(struct declaration *declaration, -- 2.34.1