From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKzzs-0004JE-DL for qemu-devel@nongnu.org; Wed, 27 Mar 2013 19:43:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKzzr-000731-8u for qemu-devel@nongnu.org; Wed, 27 Mar 2013 19:43:12 -0400 Message-ID: <515383E2.7010408@suse.de> Date: Thu, 28 Mar 2013 00:42:26 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1364410030-24008-1-git-send-email-rth@twiddle.net> In-Reply-To: <1364410030-24008-1-git-send-email-rth@twiddle.net> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] vmxnet: Don't use bswap_64 for constants List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org Am 27.03.2013 19:47, schrieb Richard Henderson: > This macro is used in the context of defining enum values. > We can't use a function call in that case. >=20 > Cc: qemu-trivial@nongnu.org > Signed-off-by: Richard Henderson > --- > hw/vmxnet3.h | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/hw/vmxnet3.h b/hw/vmxnet3.h > index 7db0c8f..cd9ac85 100644 > --- a/hw/vmxnet3.h > +++ b/hw/vmxnet3.h > @@ -37,7 +37,15 @@ > #define __packed QEMU_PACKED > =20 > #if defined(HOST_WORDS_BIGENDIAN) > -#define const_cpu_to_le64(x) bswap_64(x) > +#define const_cpu_to_le64(x) \ > + (((x & 0x00000000000000ffULL) << 56) | \ > + ((x & 0x000000000000ff00ULL) << 40) | \ > + ((x & 0x0000000000ff0000ULL) << 24) | \ > + ((x & 0x00000000ff000000ULL) << 8) | \ > + ((x & 0x000000ff00000000ULL) >> 8) | \ > + ((x & 0x0000ff0000000000ULL) >> 24) | \ > + ((x & 0x00ff000000000000ULL) >> 40) | \ > + ((x & 0xff00000000000000ULL) >> 56)) Being a macro, shouldn't this better use (x) for operator precedence? Andreas > #define __BIG_ENDIAN_BITFIELD > #else > #define const_cpu_to_le64(x) (x) >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg