[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] bswap: Fix width of swap in leul_to_cpu
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH v2] bswap: Fix width of swap in leul_to_cpu |
Date: |
Tue, 12 Feb 2013 16:48:35 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 |
Am 12.02.2013 13:33, schrieb Jay Foad:
>> +#if ULONG_MAX == UINT32_MAX
>> + return le_bswap(v, 32);
>> +#elif ULONG_MAX == UINT64_MAX
>> + return le_bswap(v, 64);
>> +#else
>> +# error Unknown sizeof long
>> +#endif
>
> Is there any reason this can't be simplified to something like:
>
> return le_bswap(v, 8 * sizeof v);
>
> ?
Yes, le_bswap() is a macro that uses glue() to get bswap64 / bswap32.
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg