16#if !defined( MI_BASE_ATOM32_USE_ATOMIC) && !defined( MI_BASE_ATOM32_USE_ASSEMBLY)
17#if defined( MI_ARCH_X86) && (defined( MI_COMPILER_GCC) || defined( MI_COMPILER_ICC))
18# define MI_BASE_ATOM32_USE_ASSEMBLY
20# define MI_BASE_ATOM32_USE_ATOMIC
25#if ! (defined( MI_BASE_ATOM32_USE_ATOMIC) ^ defined( MI_BASE_ATOM32_USE_ASSEMBLY))
26#error Exactly one of MI_BASE_ATOM32_USE_ATOMIC and MI_BASE_ATOM32_USE_ASSEMBLY should be defined.
29#if defined( MI_BASE_ATOM32_USE_ATOMIC)
51#ifndef MI_BASE_ATOM32_USE_ASSEMBLY
81 operator Uint32()
const {
return m_value; }
87#ifdef MI_BASE_ATOM32_USE_ASSEMBLY
92 std::atomic_uint32_t m_value;
96#ifndef MI_FOR_DOXYGEN_ONLY
98#ifdef MI_BASE_ATOM32_USE_ASSEMBLY
105 "lock; xaddl %0,%1\n"
107 :
"=&r"( retval),
"+m"( m_value)
120 "lock; xaddl %0,%1\n"
122 :
"=&r"( retval),
"+m"( m_value)
134 "lock; xaddl %0,%1\n"
136 :
"=&r"( retval),
"+m"( m_value)
148 "lock; xaddl %0,%1\n"
149 :
"=&r"( retval),
"+m"( m_value)
161 "lock; xaddl %0,%1\n"
163 :
"=&r"( retval),
"+m"( m_value)
175 "lock; xaddl %0,%1\n"
176 :
"=&r"( retval),
"+m"( m_value)
189 "lock; cmpxchg %2,%1\n"
191 :
"=&a"( retval),
"+m"( m_value)
200inline Atom32::Atom32(
const Atom32& other) : m_value( other.m_value.load()) { }
204 m_value = rhs.m_value.load();
242 return m_value.exchange( rhs);
A 32-bit unsigned counter with atomic arithmetic, increments, and decrements.
Definition: atom.h:43
Configuration of the Base API.
Uint32 operator-=(const Uint32 rhs)
Subtracts rhs from the counter.
Uint32 operator--(int)
Decrements the counter by one (post-decrement).
Atom32()
The default constructor initializes the counter to zero.
Definition: atom.h:46
Uint32 operator+=(const Uint32 rhs)
Adds rhs to the counter.
Uint32 operator=(const Uint32 rhs)
Assigns rhs to the counter.
Definition: atom.h:60
Uint32 operator++(int)
Increments the counter by one (post-increment).
Atom32(const Uint32 value)
This constructor initializes the counter to value.
Definition: atom.h:49
Atom32(const Atom32 &other)
The copy constructor assigns the value of other to the counter.
Uint32 operator++()
Increments the counter by one (pre-increment).
Atom32 & operator=(const Atom32 &rhs)
Assigns the value of rhs to the counter.
Uint32 swap(const Uint32 rhs)
Assigns rhs to the counter and returns the old value of counter.
Uint32 operator--()
Decrements the counter by one (pre-decrement).
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: math.h:22