diff --git a/dcopc/marshal.c b/dcopc/marshal.c index 4cc804de..9f4e3d1d 100644 --- a/dcopc/marshal.c +++ b/dcopc/marshal.c @@ -95,20 +95,16 @@ gboolean dcop_marshal_uint32( dcop_data *data, unsigned int val ) g_assert( sizeof( unsigned int ) == 4 ); -#ifdef __BIG_ENDIAN__ +#ifdef WORDS_BIGENDIAN buf[0] = val; buf[1] = val >> 8; buf[2] = val >> 16; buf[3] = val >> 24; -#endif -#ifdef __LITTLE_ENDIAN__ +#else buf[3] = val; buf[2] = val >> 8; buf[1] = val >> 16; buf[0] = val >> 24; -#endif -#if (!defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)) -#error "You cannot compile the DCOP C bindings without defining either __LITTLE_ENDIAN or __BIG_ENDIAN" #endif return dcop_marshal_raw( data, buf, 4 ); @@ -121,20 +117,16 @@ gboolean dcop_demarshal_uint32( dcop_data *data, unsigned int *val ) if ( !dcop_data_check_size( data, 4 ) ) return FALSE; -#ifdef __BIG_ENDIAN__ +#ifdef WORDS_BIGENDIAN *val = (data->cur[3] << 24) | (data->cur[2] << 16) | (data->cur[1] << 8) | data->cur[0]; -#endif -#ifdef __LITTLE_ENDIAN__ +#else *val = (data->cur[0] << 24) | (data->cur[1] << 16) | (data->cur[2] << 8) | data->cur[3]; -#endif -#if (!defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)) -#error "You cannot compile the DCOP C bindings without defining either __LITTLE_ENDIAN or __BIG_ENDIAN" #endif data->cur += 4;