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.
r~