Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-11-29 11:33:50 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-11-29 11:33:50 +0300
commitb00819bcca0c7b98af7e7e1717ccbedc2a426d57 (patch)
treee74fbdd6bbdda4a1f061c72229abe24952c18309 /intern/atomic
parent140f2209b61d637411cfbc22c755703c6220278f (diff)
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.
Diffstat (limited to 'intern/atomic')
-rw-r--r--intern/atomic/intern/atomic_ops_ext.h2
-rw-r--r--intern/atomic/intern/atomic_ops_utils.h14
2 files changed, 7 insertions, 9 deletions
diff --git a/intern/atomic/intern/atomic_ops_ext.h b/intern/atomic/intern/atomic_ops_ext.h
index 1b1fea9642d..9c3104108b1 100644
--- a/intern/atomic/intern/atomic_ops_ext.h
+++ b/intern/atomic/intern/atomic_ops_ext.h
@@ -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;
}
diff --git a/intern/atomic/intern/atomic_ops_utils.h b/intern/atomic/intern/atomic_ops_utils.h
index 621b3e95906..413983bc9a6 100644
--- a/intern/atomic/intern/atomic_ops_utils.h
+++ b/intern/atomic/intern/atomic_ops_utils.h
@@ -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__)