My Project
Loading...
Searching...
No Matches
atomic.h
Go to the documentation of this file.
1/* atomic.h
2 * Fully featured interlocked/atomic helpers for MatanelOS kernel.
3 *
4 * - Uses GCC/Clang __atomic builtins (x86_64).
5 * - Default memory ordering: sequentially consistent (__ATOMIC_SEQ_CST).
6 * - Naming follows Windows-style "Interlocked" but includes unsigned variants.
7 *
8 * Semantics summary:
9 * - Exchange functions return the previous value.
10 * - CompareExchange returns the initial value that was at target (Windows style).
11 * - Add/Increment/Decrement return the **new** value (matching InterlockedAdd semantics).
12 * - And/Or return the **previous** value (matching Windows InterlockedAnd/Or).
13 *
14 * Note: The CPU treats bit patterns the same for signed/unsigned. Use unsigned forms
15 * for bitmasks/flags to avoid sign confusion in caller code.
16 */
17
18#ifndef X86_ATOMIC_H
19#define X86_ATOMIC_H
20
21#include <stdint.h>
22#include <stddef.h>
23#include <stdbool.h>
24#include <stdatomic.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#define ATOMIC_ORDER __ATOMIC_SEQ_CST
32
33 /* Exchange (returns previous value) */
34 FORCEINLINE int8_t InterlockedExchange8(volatile int8_t* target, int8_t value) { return __atomic_exchange_n(target, value, ATOMIC_ORDER); }
35 FORCEINLINE int16_t InterlockedExchange16(volatile int16_t* target, int16_t value) { return __atomic_exchange_n(target, value, ATOMIC_ORDER); }
36 FORCEINLINE int32_t InterlockedExchange32(volatile int32_t* target, int32_t value) { return __atomic_exchange_n(target, value, ATOMIC_ORDER); }
37 FORCEINLINE int64_t InterlockedExchange64(volatile int64_t* target, int64_t value) { return __atomic_exchange_n(target, value, ATOMIC_ORDER); }
38
39 FORCEINLINE uint8_t InterlockedExchangeU8(volatile uint8_t* target, uint8_t value) { return __atomic_exchange_n(target, value, ATOMIC_ORDER); }
40 FORCEINLINE uint16_t InterlockedExchangeU16(volatile uint16_t* target, uint16_t value) { return __atomic_exchange_n(target, value, ATOMIC_ORDER); }
41 FORCEINLINE uint32_t InterlockedExchangeU32(volatile uint32_t* target, uint32_t value) { return __atomic_exchange_n(target, value, ATOMIC_ORDER); }
42 FORCEINLINE uint64_t InterlockedExchangeU64(volatile uint64_t* target, uint64_t value) { return __atomic_exchange_n(target, value, ATOMIC_ORDER); }
43
44 /* Pointer exchange */
45 FORCEINLINE void* InterlockedExchangePtr(volatile void* volatile* target, void* value) {
46 return __atomic_exchange_n((void* volatile*)target, value, ATOMIC_ORDER);
47 }
48
49 /* CompareExchange (returns initial value that was at target) */
50 FORCEINLINE int8_t InterlockedCompareExchange8(volatile int8_t* target, int8_t value, int8_t comparand) {
51 int8_t expected = comparand;
52 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
53 return expected;
54 }
55 FORCEINLINE int16_t InterlockedCompareExchange16(volatile int16_t* target, int16_t value, int16_t comparand) {
56 int16_t expected = comparand;
57 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
58 return expected;
59 }
60 FORCEINLINE int32_t InterlockedCompareExchange32(volatile int32_t* target, int32_t value, int32_t comparand) {
61 int32_t expected = comparand;
62 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
63 return expected;
64 }
65 FORCEINLINE int64_t InterlockedCompareExchange64(volatile int64_t* target, int64_t value, int64_t comparand) {
66 int64_t expected = comparand;
67 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
68 return expected;
69 }
70
71 FORCEINLINE uint8_t InterlockedCompareExchangeU8(volatile uint8_t* target, uint8_t value, uint8_t comparand) {
72 uint8_t expected = comparand;
73 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
74 return expected;
75 }
76 FORCEINLINE uint16_t InterlockedCompareExchangeU16(volatile uint16_t* target, uint16_t value, uint16_t comparand) {
77 uint16_t expected = comparand;
78 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
79 return expected;
80 }
81 FORCEINLINE uint32_t InterlockedCompareExchangeU32(volatile uint32_t* target, uint32_t value, uint32_t comparand) {
82 uint32_t expected = comparand;
83 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
84 return expected;
85 }
86 FORCEINLINE uint64_t InterlockedCompareExchangeU64(volatile uint64_t* target, uint64_t value, uint64_t comparand) {
87 uint64_t expected = comparand;
88 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
89 return expected;
90 }
91
92 /* Pointer CompareExchange */
93 FORCEINLINE void* InterlockedCompareExchangePtr(volatile void* volatile* target, void* value, void* comparand) {
94 void* expected = comparand;
95 __atomic_compare_exchange_n((void* volatile*)target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
96 return expected;
97 }
98
99 /* -------------------------------
100 Add / Inc / Dec (return NEW value)
101 ------------------------------- */
102 FORCEINLINE int8_t InterlockedAdd8(volatile int8_t* target, int8_t value) { return __atomic_add_fetch(target, value, ATOMIC_ORDER); }
103 FORCEINLINE int16_t InterlockedAdd16(volatile int16_t* target, int16_t value) { return __atomic_add_fetch(target, value, ATOMIC_ORDER); }
104 FORCEINLINE int32_t InterlockedAdd32(volatile int32_t* target, int32_t value) { return __atomic_add_fetch(target, value, ATOMIC_ORDER); }
105 FORCEINLINE int64_t InterlockedAdd64(volatile int64_t* target, int64_t value) { return __atomic_add_fetch(target, value, ATOMIC_ORDER); }
106
107 FORCEINLINE uint8_t InterlockedAddU8(volatile uint8_t* target, uint8_t value) { return __atomic_add_fetch(target, value, ATOMIC_ORDER); }
108 FORCEINLINE uint16_t InterlockedAddU16(volatile uint16_t* target, uint16_t value) { return __atomic_add_fetch(target, value, ATOMIC_ORDER); }
109 FORCEINLINE uint32_t InterlockedAddU32(volatile uint32_t* target, uint32_t value) { return __atomic_add_fetch(target, value, ATOMIC_ORDER); }
110 FORCEINLINE uint64_t InterlockedAddU64(volatile uint64_t* target, uint64_t value) { return __atomic_add_fetch(target, value, ATOMIC_ORDER); }
111
112 /* Increment / Decrement convenience (return NEW value) */
113 FORCEINLINE int32_t InterlockedIncrement32(volatile int32_t* target) { return InterlockedAdd32(target, 1); }
114 FORCEINLINE int32_t InterlockedDecrement32(volatile int32_t* target) { return InterlockedAdd32(target, -1); }
115 FORCEINLINE uint32_t InterlockedIncrementU32(volatile uint32_t* target) { return InterlockedAddU32(target, 1); }
116 FORCEINLINE uint32_t InterlockedDecrementU32(volatile uint32_t* target) { return InterlockedAddU32(target, (uint32_t)-1); }
117
118 FORCEINLINE int64_t InterlockedIncrement64(volatile int64_t* target) { return InterlockedAdd64(target, 1); }
119 FORCEINLINE uint64_t InterlockedIncrementU64(volatile uint64_t* target) { return InterlockedAddU64(target, 1); }
120
121 FORCEINLINE int64_t InterlockedDecrement64(volatile int64_t* target) { return InterlockedAdd64(target, -1); }
122 FORCEINLINE uint64_t InterlockedDecrementU64(volatile uint64_t* target) { return InterlockedAddU64(target, (uint64_t)-1); }
123 /* -------------------------------
124 Bitwise AND / OR (return PREVIOUS value)
125 ------------------------------- */
126 FORCEINLINE int8_t InterlockedAnd8(volatile int8_t* target, int8_t value) { return __atomic_fetch_and(target, value, ATOMIC_ORDER); }
127 FORCEINLINE int16_t InterlockedAnd16(volatile int16_t* target, int16_t value) { return __atomic_fetch_and(target, value, ATOMIC_ORDER); }
128 FORCEINLINE int32_t InterlockedAnd32(volatile int32_t* target, int32_t value) { return __atomic_fetch_and(target, value, ATOMIC_ORDER); }
129 FORCEINLINE int64_t InterlockedAnd64(volatile int64_t* target, int64_t value) { return __atomic_fetch_and(target, value, ATOMIC_ORDER); }
130
131 FORCEINLINE uint8_t InterlockedAndU8(volatile uint8_t* target, uint8_t value) { return __atomic_fetch_and(target, value, ATOMIC_ORDER); }
132 FORCEINLINE uint16_t InterlockedAndU16(volatile uint16_t* target, uint16_t value) { return __atomic_fetch_and(target, value, ATOMIC_ORDER); }
133 FORCEINLINE uint32_t InterlockedAndU32(volatile uint32_t* target, uint32_t value) { return __atomic_fetch_and(target, value, ATOMIC_ORDER); }
134 FORCEINLINE uint64_t InterlockedAndU64(volatile uint64_t* target, uint64_t value) { return __atomic_fetch_and(target, value, ATOMIC_ORDER); }
135
136 FORCEINLINE int8_t InterlockedOr8(volatile int8_t* target, int8_t value) { return __atomic_fetch_or(target, value, ATOMIC_ORDER); }
137 FORCEINLINE int16_t InterlockedOr16(volatile int16_t* target, int16_t value) { return __atomic_fetch_or(target, value, ATOMIC_ORDER); }
138 FORCEINLINE int32_t InterlockedOr32(volatile int32_t* target, int32_t value) { return __atomic_fetch_or(target, value, ATOMIC_ORDER); }
139 FORCEINLINE int64_t InterlockedOr64(volatile int64_t* target, int64_t value) { return __atomic_fetch_or(target, value, ATOMIC_ORDER); }
140
141 FORCEINLINE uint8_t InterlockedOrU8(volatile uint8_t* target, uint8_t value) { return __atomic_fetch_or(target, value, ATOMIC_ORDER); }
142 FORCEINLINE uint16_t InterlockedOrU16(volatile uint16_t* target, uint16_t value) { return __atomic_fetch_or(target, value, ATOMIC_ORDER); }
143 FORCEINLINE uint32_t InterlockedOrU32(volatile uint32_t* target, uint32_t value) { return __atomic_fetch_or(target, value, ATOMIC_ORDER); }
144 FORCEINLINE uint64_t InterlockedOrU64(volatile uint64_t* target, uint64_t value) { return __atomic_fetch_or(target, value, ATOMIC_ORDER); }
145
146 /* -------------------------------
147 Pointer / uintptr helpers
148 ------------------------------- */
149 FORCEINLINE uintptr_t InterlockedExchangeUintptr(volatile uintptr_t* target, uintptr_t value) {
150 return __atomic_exchange_n(target, value, ATOMIC_ORDER);
151 }
152 FORCEINLINE uintptr_t InterlockedCompareExchangeUintptr(volatile uintptr_t* target, uintptr_t value, uintptr_t comparand) {
153 uintptr_t expected = comparand;
154 __atomic_compare_exchange_n(target, &expected, value, 0, ATOMIC_ORDER, ATOMIC_ORDER);
155 return expected;
156 }
157 FORCEINLINE uintptr_t InterlockedFetchAndUintptr(volatile uintptr_t* target, uintptr_t value) {
158 return __atomic_fetch_and(target, value, ATOMIC_ORDER);
159 }
160 FORCEINLINE uintptr_t InterlockedFetchOrUintptr(volatile uintptr_t* target, uintptr_t value) {
161 return __atomic_fetch_or(target, value, ATOMIC_ORDER);
162 }
163
164 // Boolean
165 FORCEINLINE bool InterlockedExchangeBool(volatile bool* target, bool value) {
166 return __atomic_exchange_n(target, value, __ATOMIC_SEQ_CST);
167 }
168
169 /* Pointer convenience wrappers */
170 FORCEINLINE void* InterlockedExchangePointer(volatile void* volatile* target, void* value) { return InterlockedExchangePtr(target, value); }
171 FORCEINLINE void* InterlockedCompareExchangePointer(volatile void* volatile* target, void* value, void* comparand) { return InterlockedCompareExchangePtr(target, value, comparand); }
172 FORCEINLINE void* InterlockedFetchPointer(volatile void* volatile* target) { return InterlockedCompareExchangePtr(target, NULL, NULL); }
173
174 /* -------------------------------
175 Utility: test-and-set style helpers
176 ------------------------------- */
177
178 /* Atomically set bits in a uint32_t mask and return previous mask */
179 FORCEINLINE uint32_t InterlockedSetMaskU32(volatile uint32_t* target, uint32_t mask) {
180 return __atomic_fetch_or(target, mask, ATOMIC_ORDER);
181 }
182
183 /* Atomically clear bits and return previous mask */
184 FORCEINLINE uint32_t InterlockedClearMaskU32(volatile uint32_t* target, uint32_t mask) {
185 return __atomic_fetch_and(target, ~mask, ATOMIC_ORDER);
186 }
187
188 /* -------------------------------
189 Load / Store (atomic loads/stores with specified ordering)
190 ------------------------------- */
191 FORCEINLINE int32_t AtomicLoad32(volatile int32_t* target) {
192 return __atomic_load_n(target, ATOMIC_ORDER);
193 }
194 FORCEINLINE void AtomicStore32(volatile int32_t* target, int32_t v) {
195 __atomic_store_n(target, v, ATOMIC_ORDER);
196 }
197 FORCEINLINE uint32_t AtomicLoadU32(volatile uint32_t* target) {
198 return __atomic_load_n(target, ATOMIC_ORDER);
199 }
200 FORCEINLINE void AtomicStoreU32(volatile uint32_t* target, uint32_t v) {
201 __atomic_store_n(target, v, ATOMIC_ORDER);
202 }
203
204
205 FORCEINLINE int8_t InterlockedFetch8(volatile int8_t* target) { return __atomic_load_n(target, ATOMIC_ORDER); }
206 FORCEINLINE int16_t InterlockedFetch16(volatile int16_t* target) { return __atomic_load_n(target, ATOMIC_ORDER); }
207 FORCEINLINE int32_t InterlockedFetch32(volatile int32_t* target) { return __atomic_load_n(target, ATOMIC_ORDER); }
208 FORCEINLINE int64_t InterlockedFetch64(volatile int64_t* target) { return __atomic_load_n(target, ATOMIC_ORDER); }
209
210 FORCEINLINE uint8_t InterlockedFetchU8(volatile uint8_t* target) { return __atomic_load_n(target, ATOMIC_ORDER); }
211 FORCEINLINE uint16_t InterlockedFetchU16(volatile uint16_t* target) { return __atomic_load_n(target, ATOMIC_ORDER); }
212 FORCEINLINE uint32_t InterlockedFetchU32(volatile uint32_t* target) { return __atomic_load_n(target, ATOMIC_ORDER); }
213 FORCEINLINE uint64_t InterlockedFetchU64(volatile uint64_t* target) { return __atomic_load_n(target, ATOMIC_ORDER); }
214 /* -------------------------------
215 Notes:
216 - Types may be signed or unsigned; operations are bit-pattern operations.
217 - On x86_64 the builtins will generate LOCK-prefixed instructions where necessary.
218 - For 8/16-bit atomics be careful about alignment; prefer natural alignment for the type.
219 ------------------------------- */
220
221#ifdef __cplusplus
222}
223#endif
224
225#endif /* MATANEL_ATOMIC_H */
#define FORCEINLINE
Definition annotations.h:22
FORCEINLINE int8_t InterlockedOr8(volatile int8_t *target, int8_t value)
Definition atomic.h:136
FORCEINLINE int64_t InterlockedCompareExchange64(volatile int64_t *target, int64_t value, int64_t comparand)
Definition atomic.h:65
FORCEINLINE uint8_t InterlockedAndU8(volatile uint8_t *target, uint8_t value)
Definition atomic.h:131
FORCEINLINE int64_t InterlockedAdd64(volatile int64_t *target, int64_t value)
Definition atomic.h:105
FORCEINLINE uint8_t InterlockedExchangeU8(volatile uint8_t *target, uint8_t value)
Definition atomic.h:39
FORCEINLINE int32_t InterlockedAnd32(volatile int32_t *target, int32_t value)
Definition atomic.h:128
FORCEINLINE int64_t InterlockedIncrement64(volatile int64_t *target)
Definition atomic.h:118
FORCEINLINE int64_t InterlockedOr64(volatile int64_t *target, int64_t value)
Definition atomic.h:139
FORCEINLINE uint8_t InterlockedFetchU8(volatile uint8_t *target)
Definition atomic.h:210
FORCEINLINE void AtomicStoreU32(volatile uint32_t *target, uint32_t v)
Definition atomic.h:200
FORCEINLINE uintptr_t InterlockedCompareExchangeUintptr(volatile uintptr_t *target, uintptr_t value, uintptr_t comparand)
Definition atomic.h:152
FORCEINLINE int64_t InterlockedFetch64(volatile int64_t *target)
Definition atomic.h:208
FORCEINLINE uint32_t InterlockedIncrementU32(volatile uint32_t *target)
Definition atomic.h:115
FORCEINLINE int16_t InterlockedFetch16(volatile int16_t *target)
Definition atomic.h:206
FORCEINLINE int32_t InterlockedDecrement32(volatile int32_t *target)
Definition atomic.h:114
FORCEINLINE uint64_t InterlockedAndU64(volatile uint64_t *target, uint64_t value)
Definition atomic.h:134
FORCEINLINE int32_t InterlockedOr32(volatile int32_t *target, int32_t value)
Definition atomic.h:138
FORCEINLINE int8_t InterlockedCompareExchange8(volatile int8_t *target, int8_t value, int8_t comparand)
Definition atomic.h:50
FORCEINLINE uint16_t InterlockedFetchU16(volatile uint16_t *target)
Definition atomic.h:211
FORCEINLINE int16_t InterlockedAnd16(volatile int16_t *target, int16_t value)
Definition atomic.h:127
FORCEINLINE uint64_t InterlockedCompareExchangeU64(volatile uint64_t *target, uint64_t value, uint64_t comparand)
Definition atomic.h:86
FORCEINLINE int32_t AtomicLoad32(volatile int32_t *target)
Definition atomic.h:191
FORCEINLINE uint8_t InterlockedOrU8(volatile uint8_t *target, uint8_t value)
Definition atomic.h:141
FORCEINLINE void * InterlockedExchangePtr(volatile void *volatile *target, void *value)
Definition atomic.h:45
FORCEINLINE uint64_t InterlockedIncrementU64(volatile uint64_t *target)
Definition atomic.h:119
FORCEINLINE int32_t InterlockedCompareExchange32(volatile int32_t *target, int32_t value, int32_t comparand)
Definition atomic.h:60
FORCEINLINE uint8_t InterlockedCompareExchangeU8(volatile uint8_t *target, uint8_t value, uint8_t comparand)
Definition atomic.h:71
FORCEINLINE uint16_t InterlockedAndU16(volatile uint16_t *target, uint16_t value)
Definition atomic.h:132
FORCEINLINE void AtomicStore32(volatile int32_t *target, int32_t v)
Definition atomic.h:194
FORCEINLINE int8_t InterlockedFetch8(volatile int8_t *target)
Definition atomic.h:205
FORCEINLINE int32_t InterlockedAdd32(volatile int32_t *target, int32_t value)
Definition atomic.h:104
FORCEINLINE uint32_t InterlockedAddU32(volatile uint32_t *target, uint32_t value)
Definition atomic.h:109
FORCEINLINE uint32_t InterlockedSetMaskU32(volatile uint32_t *target, uint32_t mask)
Definition atomic.h:179
FORCEINLINE void * InterlockedCompareExchangePointer(volatile void *volatile *target, void *value, void *comparand)
Definition atomic.h:171
FORCEINLINE uint16_t InterlockedExchangeU16(volatile uint16_t *target, uint16_t value)
Definition atomic.h:40
FORCEINLINE uint32_t InterlockedFetchU32(volatile uint32_t *target)
Definition atomic.h:212
FORCEINLINE int16_t InterlockedAdd16(volatile int16_t *target, int16_t value)
Definition atomic.h:103
FORCEINLINE uint16_t InterlockedOrU16(volatile uint16_t *target, uint16_t value)
Definition atomic.h:142
FORCEINLINE uint32_t InterlockedClearMaskU32(volatile uint32_t *target, uint32_t mask)
Definition atomic.h:184
FORCEINLINE uint32_t AtomicLoadU32(volatile uint32_t *target)
Definition atomic.h:197
FORCEINLINE uint64_t InterlockedFetchU64(volatile uint64_t *target)
Definition atomic.h:213
FORCEINLINE int32_t InterlockedIncrement32(volatile int32_t *target)
Definition atomic.h:113
FORCEINLINE uint64_t InterlockedExchangeU64(volatile uint64_t *target, uint64_t value)
Definition atomic.h:42
FORCEINLINE uint16_t InterlockedCompareExchangeU16(volatile uint16_t *target, uint16_t value, uint16_t comparand)
Definition atomic.h:76
FORCEINLINE int8_t InterlockedAdd8(volatile int8_t *target, int8_t value)
Definition atomic.h:102
FORCEINLINE void * InterlockedExchangePointer(volatile void *volatile *target, void *value)
Definition atomic.h:170
FORCEINLINE int64_t InterlockedDecrement64(volatile int64_t *target)
Definition atomic.h:121
FORCEINLINE uint32_t InterlockedDecrementU32(volatile uint32_t *target)
Definition atomic.h:116
FORCEINLINE uint64_t InterlockedDecrementU64(volatile uint64_t *target)
Definition atomic.h:122
FORCEINLINE int64_t InterlockedAnd64(volatile int64_t *target, int64_t value)
Definition atomic.h:129
#define ATOMIC_ORDER
Definition atomic.h:31
FORCEINLINE uint8_t InterlockedAddU8(volatile uint8_t *target, uint8_t value)
Definition atomic.h:107
FORCEINLINE uintptr_t InterlockedFetchAndUintptr(volatile uintptr_t *target, uintptr_t value)
Definition atomic.h:157
FORCEINLINE int16_t InterlockedCompareExchange16(volatile int16_t *target, int16_t value, int16_t comparand)
Definition atomic.h:55
FORCEINLINE int32_t InterlockedExchange32(volatile int32_t *target, int32_t value)
Definition atomic.h:36
FORCEINLINE uint32_t InterlockedExchangeU32(volatile uint32_t *target, uint32_t value)
Definition atomic.h:41
FORCEINLINE uintptr_t InterlockedExchangeUintptr(volatile uintptr_t *target, uintptr_t value)
Definition atomic.h:149
FORCEINLINE bool InterlockedExchangeBool(volatile bool *target, bool value)
Definition atomic.h:165
FORCEINLINE uint32_t InterlockedOrU32(volatile uint32_t *target, uint32_t value)
Definition atomic.h:143
FORCEINLINE void * InterlockedFetchPointer(volatile void *volatile *target)
Definition atomic.h:172
FORCEINLINE int32_t InterlockedFetch32(volatile int32_t *target)
Definition atomic.h:207
FORCEINLINE uint32_t InterlockedCompareExchangeU32(volatile uint32_t *target, uint32_t value, uint32_t comparand)
Definition atomic.h:81
FORCEINLINE int8_t InterlockedExchange8(volatile int8_t *target, int8_t value)
Definition atomic.h:34
FORCEINLINE void * InterlockedCompareExchangePtr(volatile void *volatile *target, void *value, void *comparand)
Definition atomic.h:93
FORCEINLINE uint64_t InterlockedAddU64(volatile uint64_t *target, uint64_t value)
Definition atomic.h:110
FORCEINLINE uint16_t InterlockedAddU16(volatile uint16_t *target, uint16_t value)
Definition atomic.h:108
FORCEINLINE uint32_t InterlockedAndU32(volatile uint32_t *target, uint32_t value)
Definition atomic.h:133
FORCEINLINE uintptr_t InterlockedFetchOrUintptr(volatile uintptr_t *target, uintptr_t value)
Definition atomic.h:160
FORCEINLINE int16_t InterlockedOr16(volatile int16_t *target, int16_t value)
Definition atomic.h:137
FORCEINLINE int8_t InterlockedAnd8(volatile int8_t *target, int8_t value)
Definition atomic.h:126
FORCEINLINE int64_t InterlockedExchange64(volatile int64_t *target, int64_t value)
Definition atomic.h:37
FORCEINLINE int16_t InterlockedExchange16(volatile int16_t *target, int16_t value)
Definition atomic.h:35
FORCEINLINE uint64_t InterlockedOrU64(volatile uint64_t *target, uint64_t value)
Definition atomic.h:144