summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-marshal-basic.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2009-07-16 16:05:16 +0200
committerThiago Macieira <thiago@kde.org>2009-07-16 16:05:16 +0200
commit37019e9d271390fa8c62c1aae62d30bb9068adaa (patch)
tree536d5838b73939a6a885f4ef61de1c18814b9529 /dbus/dbus-marshal-basic.h
parent56f7ce147e82c7eb529ccba634013e97d53b23c0 (diff)
parent9f06daccce3f4e75cfac7c97bfb1743affb55cb2 (diff)
Merge branch 'fd-passing'
Conflicts: dbus/dbus-connection.c dbus/dbus-message-util.c dbus/dbus-sysdeps-unix.c
Diffstat (limited to 'dbus/dbus-marshal-basic.h')
-rw-r--r--dbus/dbus-marshal-basic.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/dbus/dbus-marshal-basic.h b/dbus/dbus-marshal-basic.h
index 68ced4d2..fd87a80f 100644
--- a/dbus/dbus-marshal-basic.h
+++ b/dbus/dbus-marshal-basic.h
@@ -26,21 +26,27 @@
#define DBUS_MARSHAL_BASIC_H
#include <config.h>
+
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#endif
+
#include <dbus/dbus-protocol.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-arch-deps.h>
#include <dbus/dbus-string.h>
-#ifndef PACKAGE
-#error "config.h not included here"
-#endif
-
#ifdef WORDS_BIGENDIAN
#define DBUS_COMPILER_BYTE_ORDER DBUS_BIG_ENDIAN
#else
#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)))
@@ -51,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) | \
@@ -72,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))