From 3801b6de7878074a8e77445bad2a2d093889a3af Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 22 Apr 2009 02:46:35 +0200 Subject: build-system: get rid of config.h inclusion checks These header files include config.h explicitly anyway. These checks are hence pointless. Of course one could argue that including config.h from header files sucks, but D-Bus generally seems not to have a problem with that, so let's unify this. --- dbus/dbus-marshal-basic.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'dbus/dbus-marshal-basic.h') diff --git a/dbus/dbus-marshal-basic.h b/dbus/dbus-marshal-basic.h index 28c751f4..bcc15ee9 100644 --- a/dbus/dbus-marshal-basic.h +++ b/dbus/dbus-marshal-basic.h @@ -31,10 +31,6 @@ #include #include -#ifndef PACKAGE -#error "config.h not included here" -#endif - #ifdef WORDS_BIGENDIAN #define DBUS_COMPILER_BYTE_ORDER DBUS_BIG_ENDIAN #else -- cgit From ec901d786f6de6e6f870279e2d955f491619c559 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 19 May 2009 22:34:43 +0200 Subject: byteswap: make use of glibc specific bytswap primitives glibc knows three bswap_{16|32|64}() calls that internally make use of a gcc extension to implement faster byteswapping. We should make use of it if we can. --- dbus/dbus-marshal-basic.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'dbus/dbus-marshal-basic.h') diff --git a/dbus/dbus-marshal-basic.h b/dbus/dbus-marshal-basic.h index bcc15ee9..f09c5208 100644 --- a/dbus/dbus-marshal-basic.h +++ b/dbus/dbus-marshal-basic.h @@ -26,6 +26,11 @@ #define DBUS_MARSHAL_BASIC_H #include + +#ifdef HAVE_BYTESWAP_H +#include +#endif + #include #include #include @@ -37,6 +42,11 @@ #define DBUS_COMPILER_BYTE_ORDER DBUS_LITTLE_ENDIAN #endif +#ifdef HAVE_BYTESWAP_H +#define DBUS_UINT16_SWAP_LE_BE_CONSTANT(val) bswap_16(val) +#define DBUS_UINT32_SWAP_LE_BE_CONSTANT(val) bswap_32(val) +#else /* HAVE_BYTESWAP_H */ + #define DBUS_UINT16_SWAP_LE_BE_CONSTANT(val) ((dbus_uint16_t) ( \ (dbus_uint16_t) ((dbus_uint16_t) (val) >> 8) | \ (dbus_uint16_t) ((dbus_uint16_t) (val) << 8))) @@ -47,8 +57,14 @@ (((dbus_uint32_t) (val) & (dbus_uint32_t) 0x00ff0000U) >> 8) | \ (((dbus_uint32_t) (val) & (dbus_uint32_t) 0xff000000U) >> 24))) +#endif /* HAVE_BYTESWAP_H */ + #ifdef DBUS_HAVE_INT64 +#ifdef HAVE_BYTESWAP_H +#define DBUS_UINT64_SWAP_LE_BE_CONSTANT(val) bswap_64(val) +#else /* HAVE_BYTESWAP_H */ + #define DBUS_UINT64_SWAP_LE_BE_CONSTANT(val) ((dbus_uint64_t) ( \ (((dbus_uint64_t) (val) & \ (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x00000000000000ff)) << 56) | \ @@ -68,6 +84,8 @@ (dbus_uint64_t) DBUS_UINT64_CONSTANT (0xff00000000000000)) >> 56))) #endif /* DBUS_HAVE_INT64 */ +#endif /* HAVE_BYTESWAP_H */ + #define DBUS_UINT16_SWAP_LE_BE(val) (DBUS_UINT16_SWAP_LE_BE_CONSTANT (val)) #define DBUS_INT16_SWAP_LE_BE(val) ((dbus_int16_t)DBUS_UINT16_SWAP_LE_BE_CONSTANT (val)) -- cgit