From a0b720b2a81ab7d49c21410f3048aea0dcb50279 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 6 Oct 2015 12:09:02 -0400 Subject: [PATCH] Port: Add Solaris endian.h compat MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/stream-class.c | 1 + formats/ctf/ir/trace.c | 1 + include/babeltrace/endian.h | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/formats/ctf/ir/stream-class.c b/formats/ctf/ir/stream-class.c index 573fb421..aa196a47 100644 --- a/formats/ctf/ir/stream-class.c +++ b/formats/ctf/ir/stream-class.c @@ -40,6 +40,7 @@ #include #include #include +#include static void bt_ctf_stream_class_destroy(struct bt_object *obj); diff --git a/formats/ctf/ir/trace.c b/formats/ctf/ir/trace.c index f96ce87c..c2f8be48 100644 --- a/formats/ctf/ir/trace.c +++ b/formats/ctf/ir/trace.c @@ -38,6 +38,7 @@ #include #include #include +#include #define DEFAULT_IDENTIFIER_SIZE 128 #define DEFAULT_METADATA_STRING_SIZE 4096 diff --git a/include/babeltrace/endian.h b/include/babeltrace/endian.h index 001a4717..f0299ade 100644 --- a/include/babeltrace/endian.h +++ b/include/babeltrace/endian.h @@ -29,6 +29,42 @@ #ifdef __FreeBSD__ #include + +#elif defined(__sun__) +#include + +#ifndef __BIG_ENDIAN +#define __BIG_ENDIAN 4321 +#endif +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif + +#ifdef _LITTLE_ENDIAN +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#ifdef _BIG_ENDIAN +#define __BYTE_ORDER __BIG_ENDIAN +#endif + +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#define BYTE_ORDER __BYTE_ORDER + +#define betoh16(x) BE_16(x) +#define letoh16(x) LE_16(x) +#define betoh32(x) BE_32(x) +#define letoh32(x) LE_32(x) +#define betoh64(x) BE_64(x) +#define letoh64(x) LE_64(x) +#define htobe16(x) BE_16(x) +#define be16toh(x) BE_16(x) +#define htobe32(x) BE_32(x) +#define be32toh(x) BE_32(x) +#define htobe64(x) BE_64(x) +#define be64toh(x) BE_64(x) + #elif defined(__MINGW32__) #ifndef __BIG_ENDIAN #define __BIG_ENDIAN 4321 -- 2.34.1