On 4/26/23 22:10, Juan Quintela wrote:
Don't use __nocheck() functions.

Doesn't this break on 32-bit platforms?

#if defined(__x86_64__) || defined(__sparc__) || defined(__mips64)
# define ATOMIC_REG_SIZE  8
#else
# define ATOMIC_REG_SIZE  sizeof(void *)
#endif

#define qatomic_set(ptr, i)  do {                      \
    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \
    qatomic_set__nocheck(ptr, i);                      \
} while(0)

So if sizeof(void*) == 4 it would trigger a compile-time assertion.

Paolo


Reply via email to