 |
Blender V4.3
|
Go to the documentation of this file.
49#ifndef __ATOMIC_OPS_UTILS_H__
50#define __ATOMIC_OPS_UTILS_H__
61# define ATOMIC_INLINE static __forceinline
63# define ATOMIC_INLINE static inline __attribute__((always_inline))
67# define _ATOMIC_LIKELY(x) __builtin_expect(!!(x), 1)
68# define _ATOMIC_UNLIKELY(x) __builtin_expect(!!(x), 0)
69# define _ATOMIC_MAYBE_UNUSED __attribute__((unused))
71# define _ATOMIC_LIKELY(x) (x)
72# define _ATOMIC_UNLIKELY(x) (x)
73# define _ATOMIC_MAYBE_UNUSED
76#if defined(__SIZEOF_POINTER__)
77# define LG_SIZEOF_PTR __SIZEOF_POINTER__
78#elif defined(UINTPTR_MAX)
79# if (UINTPTR_MAX == 0xFFFFFFFF)
80# define LG_SIZEOF_PTR 4
81# elif (UINTPTR_MAX == 0xFFFFFFFFFFFFFFFF)
82# define LG_SIZEOF_PTR 8
84#elif defined(__WORDSIZE)
85# if (__WORDSIZE == 32)
86# define LG_SIZEOF_PTR 4
87# elif (__WORDSIZE == 64)
88# define LG_SIZEOF_PTR 8
93# error "Cannot find pointer size"
96#if (UINT_MAX == 0xFFFFFFFF)
97# define LG_SIZEOF_INT 4
98#elif (UINT_MAX == 0xFFFFFFFFFFFFFFFF)
99# define LG_SIZEOF_INT 8
101# error "Cannot find int size"
107#if (!defined(__cplusplus)) && (!defined(__COVERITY__)) && (defined(__GNUC__))
108# define ATOMIC_STATIC_ASSERT(a, msg) __extension__ _Static_assert(a, msg);
113# define ATOMIC_ASSERT_CONCAT_(a, b) a##b
114# define ATOMIC_ASSERT_CONCAT(a, b) ATOMIC_ASSERT_CONCAT_(a, b)
116# if defined(__COUNTER__)
117# define ATOMIC_STATIC_ASSERT(a, msg) \
119 enum { ATOMIC_ASSERT_CONCAT(static_assert_, __COUNTER__) = 1 / (int)(!!(a)) };
125# define ATOMIC_STATIC_ASSERT(a, msg) \
127 enum { ATOMIC_ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(a)) };