Am 30.01.2013 22:59, schrieb Richard Henderson: > On 01/30/2013 01:04 PM, Stefan Weil wrote: >>> static inline unsigned long leul_to_cpu(unsigned long v) >>> { >>> - return le_bswap(v, HOST_LONG_BITS); >>> + /* In order to break an include loop between here and >>> + qemu-common.h, don't rely on HOST_LONG_BITS. */ >>> +#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 >>> } >>> >>> #undef le_bswap >> >> That would be wrong for 64 bit MinGW-w64 because >> HOST_LONG_BITS is _not_ the bit size of a long value. >> >> See qemu-common.h for the correct definition. > > I beg your pardon, but it *is* right. HOST_LONG_BITS is set to the size > of a host pointer, not a host long. Which suggests that my patch is the > *only* correct way to do this, at least for now.
IIUC on w64 ULONG_MAX == UINT32_MAX but 64 is desired for pointer. w64 is not C99-compliant. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg