Atomic: Avoid conflicts with definitions in other areas
While atomics library was trying to use "user-space" defined LIKELY() and UNLIKELY(), this is not always true that user code was checking for those macro coming from an unrelated area.
This commit is contained in:
parent
140f2209b6
commit
b00819bcca
@ -206,7 +206,7 @@ ATOMIC_INLINE float atomic_add_and_fetch_fl(float *p, const float x)
|
||||
oldval = *p;
|
||||
newval = oldval + x;
|
||||
prevval = atomic_cas_uint32((uint32_t *)p, *(uint32_t *)(&oldval), *(uint32_t *)(&newval));
|
||||
} while (UNLIKELY(prevval != *(uint32_t *)(&oldval)));
|
||||
} while (_ATOMIC_UNLIKELY(prevval != *(uint32_t *)(&oldval)));
|
||||
|
||||
return newval;
|
||||
}
|
||||
|
@ -66,14 +66,12 @@
|
||||
# define ATOMIC_INLINE static inline __attribute__((always_inline))
|
||||
#endif
|
||||
|
||||
#ifndef LIKELY
|
||||
# ifdef __GNUC__
|
||||
# define LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
# define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
# else
|
||||
# define LIKELY(x) (x)
|
||||
# define UNLIKELY(x) (x)
|
||||
# endif
|
||||
#ifdef __GNUC__
|
||||
# define _ATOMIC_LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
# define _ATOMIC_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
# define _ATOMIC_LIKELY(x) (x)
|
||||
# define _ATOMIC_UNLIKELY(x) (x)
|
||||
#endif
|
||||
|
||||
#if defined(__SIZEOF_POINTER__)
|
||||
|
Loading…
Reference in New Issue
Block a user