diff --git a/include/qemu-common.h b/include/qemu-common.h index 5a2d9972bd..fbd999cbcd 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -23,15 +23,6 @@ #include "qemu/option.h" #include "qemu/host-utils.h" -/* HOST_LONG_BITS is the size of a native pointer in bits. */ -#if UINTPTR_MAX == UINT32_MAX -# define HOST_LONG_BITS 32 -#elif UINTPTR_MAX == UINT64_MAX -# define HOST_LONG_BITS 64 -#else -# error Unknown pointer size -#endif - void cpu_ticks_init(void); /* icount */ diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 95071ba9e8..fcedf0d249 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -419,11 +419,9 @@ static inline void stfq_be_p(void *ptr, float64 v) static inline unsigned long leul_to_cpu(unsigned long v) { - /* 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 +#if HOST_LONG_BITS == 32 return le_bswap(v, 32); -#elif ULONG_MAX == UINT64_MAX +#elif HOST_LONG_BITS == 64 return le_bswap(v, 64); #else # error Unknown sizeof long diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 1c0ce4a1c7..64b06e30cd 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -127,6 +127,15 @@ extern int daemon(int, int); #define TIME_MAX LONG_MAX #endif +/* HOST_LONG_BITS is the size of a native pointer in bits. */ +#if UINTPTR_MAX == UINT32_MAX +# define HOST_LONG_BITS 32 +#elif UINTPTR_MAX == UINT64_MAX +# define HOST_LONG_BITS 64 +#else +# error Unknown pointer size +#endif + #ifndef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif