blob: 0d3e6afd203c0231f8fc7cc79c00cd10285eb4d1 [file] [log] [blame]
Howard Hinnant8f73c632010-09-27 21:17:38 +00001// -*- C++ -*-
2//===--------------------------- atomic -----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_ATOMIC
12#define _LIBCPP_ATOMIC
13
14/*
15 atomic synopsis
16
17namespace std
18{
19
20// order and consistency
21
22typedef enum memory_order
23{
Howard Hinnantd1176e22010-09-28 17:13:38 +000024 memory_order_relaxed,
25 memory_order_consume, // load-consume
26 memory_order_acquire, // load-acquire
27 memory_order_release, // store-release
28 memory_order_acq_rel, // store-release load-acquire
29 memory_order_seq_cst // store-release load-acquire
Howard Hinnant8f73c632010-09-27 21:17:38 +000030} memory_order;
31
32template <class T> T kill_dependency(T y);
33
34// lock-free property
35
36#define ATOMIC_CHAR_LOCK_FREE unspecified
37#define ATOMIC_CHAR16_T_LOCK_FREE unspecified
38#define ATOMIC_CHAR32_T_LOCK_FREE unspecified
39#define ATOMIC_WCHAR_T_LOCK_FREE unspecified
40#define ATOMIC_SHORT_LOCK_FREE unspecified
41#define ATOMIC_INT_LOCK_FREE unspecified
42#define ATOMIC_LONG_LOCK_FREE unspecified
43#define ATOMIC_LLONG_LOCK_FREE unspecified
44#define ATOMIC_ADDRESS_LOCK_FREE unspecified
45
Howard Hinnant8f73c632010-09-27 21:17:38 +000046// flag type and operations
47
48typedef struct atomic_flag
49{
50 bool test_and_set(memory_order = memory_order_seq_cst) volatile;
51 bool test_and_set(memory_order = memory_order_seq_cst);
52 void clear(memory_order = memory_order_seq_cst) volatile;
53 void clear(memory_order = memory_order_seq_cst);
54 atomic_flag() = default;
55 atomic_flag(const atomic_flag&) = delete;
56 atomic_flag& operator=(const atomic_flag&) = delete;
57 atomic_flag& operator=(const atomic_flag&) volatile = delete;
58} atomic_flag;
59
60bool atomic_flag_test_and_set(volatile atomic_flag*);
61bool atomic_flag_test_and_set(atomic_flag*);
62bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order);
63bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order);
64void atomic_flag_clear(volatile atomic_flag*);
65void atomic_flag_clear(atomic_flag*);
66void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order);
67void atomic_flag_clear_explicit(atomic_flag*, memory_order);
68
69#define ATOMIC_FLAG_INIT see below
Howard Hinnante7385012010-10-19 16:51:18 +000070#define ATOMIC_VAR_INIT(value) see below
Howard Hinnant8f73c632010-09-27 21:17:38 +000071
72// atomic_bool
73
74typedef struct atomic_bool
75{
76 bool is_lock_free() const volatile;
77 bool is_lock_free() const;
78 void store(bool, memory_order = memory_order_seq_cst) volatile;
79 void store(bool, memory_order = memory_order_seq_cst);
80 bool load(memory_order = memory_order_seq_cst) const volatile;
81 bool load(memory_order = memory_order_seq_cst) const;
82 operator bool() const volatile;
83 operator bool() const;
84 bool exchange(bool, memory_order = memory_order_seq_cst) volatile;
85 bool exchange(bool, memory_order = memory_order_seq_cst);
86 bool compare_exchange_weak(bool&, bool, memory_order,
87 memory_order) volatile;
88 bool compare_exchange_weak(bool&, bool, memory_order, memory_order);
89 bool compare_exchange_strong(bool&, bool, memory_order,
90 memory_order) volatile;
91 bool compare_exchange_strong(bool&, bool, memory_order, memory_order);
92 bool compare_exchange_weak(bool&, bool,
93 memory_order = memory_order_seq_cst) volatile;
94 bool compare_exchange_weak(bool&, bool,
95 memory_order = memory_order_seq_cst);
96 bool compare_exchange_strong(bool&, bool,
97 memory_order = memory_order_seq_cst) volatile;
98 bool compare_exchange_strong(bool&, bool,
99 memory_order = memory_order_seq_cst);
100 atomic_bool() = default;
101 constexpr atomic_bool(bool);
102 atomic_bool(const atomic_bool&) = delete;
103 atomic_bool& operator=(const atomic_bool&) = delete;
104 atomic_bool& operator=(const atomic_bool&) volatile = delete;
105 bool operator=(bool) volatile;
Howard Hinnante7385012010-10-19 16:51:18 +0000106 bool operator=(bool);
Howard Hinnant8f73c632010-09-27 21:17:38 +0000107} atomic_bool;
108
109bool atomic_is_lock_free(const volatile atomic_bool*);
110bool atomic_is_lock_free(const atomic_bool*);
111void atomic_init(volatile atomic_bool*, bool);
112void atomic_init(atomic_bool*, bool);
113void atomic_store(volatile atomic_bool*, bool);
114void atomic_store(atomic_bool*, bool);
115void atomic_store_explicit(volatile atomic_bool*, bool, memory_order);
116void atomic_store_explicit(atomic_bool*, bool, memory_order);
117bool atomic_load(const volatile atomic_bool*);
118bool atomic_load(const atomic_bool*);
119bool atomic_load_explicit(const volatile atomic_bool*, memory_order);
120bool atomic_load_explicit(const atomic_bool*, memory_order);
121bool atomic_exchange(volatile atomic_bool*, bool);
122bool atomic_exchange(atomic_bool*, bool);
123bool atomic_exchange_explicit(volatile atomic_bool*, bool, memory_order);
124bool atomic_exchange_explicit(atomic_bool*, bool, memory_order);
125bool atomic_compare_exchange_weak(volatile atomic_bool*, bool*, bool);
126bool atomic_compare_exchange_weak(atomic_bool*, bool*, bool);
127bool atomic_compare_exchange_strong(volatile atomic_bool*, bool*, bool);
128bool atomic_compare_exchange_strong(atomic_bool*, bool*, bool);
129bool atomic_compare_exchange_weak_explicit(volatile atomic_bool*, bool*, bool,
130 memory_order, memory_order);
131bool atomic_compare_exchange_weak_explicit(atomic_bool*, bool*, bool,
132 memory_order, memory_order);
133bool atomic_compare_exchange_strong_explicit(volatile atomic_bool*, bool*, bool,
134 memory_order, memory_order);
135bool atomic_compare_exchange_strong_explicit(atomic_bool*, bool*, bool,
136 memory_order, memory_order);
137
138// atomic_char
139
140typedef struct atomic_char
141{
142 bool is_lock_free() const volatile;
143 bool is_lock_free() const;
144 void store(char, memory_order = memory_order_seq_cst) volatile;
145 void store(char, memory_order = memory_order_seq_cst);
146 char load(memory_order = memory_order_seq_cst) const volatile;
147 char load(memory_order = memory_order_seq_cst) const;
148 operator char() const volatile;
149 operator char() const;
Howard Hinnante7385012010-10-19 16:51:18 +0000150 char exchange(char, memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +0000151 char exchange(char, memory_order = memory_order_seq_cst);
152 bool compare_exchange_weak(char&, char, memory_order,
153 memory_order) volatile;
154 bool compare_exchange_weak(char&, char, memory_order, memory_order);
155 bool compare_exchange_strong(char&, char, memory_order,
156 memory_order) volatile;
157 bool compare_exchange_strong(char&, char, memory_order, memory_order);
158 bool compare_exchange_weak(char&, char,
159 memory_order = memory_order_seq_cst) volatile;
160 bool compare_exchange_weak(char&, char,
161 memory_order = memory_order_seq_cst);
162 bool compare_exchange_strong(char&, char,
163 memory_order = memory_order_seq_cst) volatile;
164 bool compare_exchange_strong(char&, char,
165 memory_order = memory_order_seq_cst);
166 char fetch_add(char, memory_order = memory_order_seq_cst) volatile;
167 char fetch_add(char, memory_order = memory_order_seq_cst);
168 char fetch_sub(char, memory_order = memory_order_seq_cst) volatile;
169 char fetch_sub(char, memory_order = memory_order_seq_cst);
170 char fetch_and(char, memory_order = memory_order_seq_cst) volatile;
171 char fetch_and(char, memory_order = memory_order_seq_cst);
172 char fetch_or(char, memory_order = memory_order_seq_cst) volatile;
173 char fetch_or(char, memory_order = memory_order_seq_cst);
174 char fetch_xor(char, memory_order = memory_order_seq_cst) volatile;
175 char fetch_xor(char, memory_order = memory_order_seq_cst);
176 atomic_char() = default;
177 constexpr atomic_char(char);
178 atomic_char(const atomic_char&) = delete;
179 atomic_char& operator=(const atomic_char&) = delete;
180 atomic_char& operator=(const atomic_char&) volatile = delete;
181 char operator=(char) volatile;
182 char operator=(char);
183 char operator++(int) volatile;
184 char operator++(int);
185 char operator--(int) volatile;
186 char operator--(int);
187 char operator++() volatile;
188 char operator++();
189 char operator--() volatile;
190 char operator--();
191 char operator+=(char) volatile;
192 char operator+=(char);
193 char operator-=(char) volatile;
194 char operator-=(char);
195 char operator&=(char) volatile;
196 char operator&=(char);
197 char operator|=(char) volatile;
198 char operator|=(char);
199 char operator^=(char) volatile;
200 char operator^=(char);
201} atomic_char;
202
203bool atomic_is_lock_free(const volatile atomic_char*);
204bool atomic_is_lock_free(const atomic_char*);
Howard Hinnante7385012010-10-19 16:51:18 +0000205void atomic_init(volatile atomic_char*, char);
206void atomic_init(atomic_char*, char);
Howard Hinnant8f73c632010-09-27 21:17:38 +0000207void atomic_store(volatile atomic_char*, char);
208void atomic_store(atomic_char*, char);
209void atomic_store_explicit(volatile atomic_char*, char, memory_order);
210void atomic_store_explicit(atomic_char*, char, memory_order);
211char atomic_load(const volatile atomic_char*);
212char atomic_load(const atomic_char*);
213char atomic_load_explicit(const volatile atomic_char*, memory_order);
214char atomic_load_explicit(const atomic_char*, memory_order);
215char atomic_exchange(volatile atomic_char*, char);
216char atomic_exchange(atomic_char*, char);
217char atomic_exchange_explicit(volatile atomic_char*, char, memory_order);
218char atomic_exchange_explicit(atomic_char*, char, memory_order);
219bool atomic_compare_exchange_weak(volatile atomic_char*, char*, char);
220bool atomic_compare_exchange_weak(atomic_char*, char*, char);
221bool atomic_compare_exchange_strong(volatile atomic_char*, char*, char);
222bool atomic_compare_exchange_strong(atomic_char*, char*, char);
223bool atomic_compare_exchange_weak_explicit(volatile atomic_char*, char*, char,
224 memory_order, memory_order);
225bool atomic_compare_exchange_weak_explicit(atomic_char*, char*, char,
226 memory_order, memory_order);
227bool atomic_compare_exchange_strong_explicit(volatile atomic_char*, char*, char,
228 memory_order, memory_order);
229bool atomic_compare_exchange_strong_explicit(atomic_char*, char*, char,
230 memory_order, memory_order);
231char atomic_fetch_add(volatile atomic_char*, char);
232char atomic_fetch_add(atomic_char*, char);
233char atomic_fetch_add_explicit(volatile atomic_char*, char, memory_order);
234char atomic_fetch_add_explicit(atomic_char*, char, memory_order);
235char atomic_fetch_sub(volatile atomic_char*, char);
236char atomic_fetch_sub(atomic_char*, char);
237char atomic_fetch_sub_explicit(volatile atomic_char*, char, memory_order);
238char atomic_fetch_sub_explicit(atomic_char*, char, memory_order);
239char atomic_fetch_and(volatile atomic_char*, char);
240char atomic_fetch_and(atomic_char*, char);
241char atomic_fetch_and_explicit(volatile atomic_char*, char, memory_order);
242char atomic_fetch_and_explicit(atomic_char*, char, memory_order);
243char atomic_fetch_or(volatile atomic_char*, char);
244char atomic_fetch_or(atomic_char*, char);
245char atomic_fetch_or_explicit(volatile atomic_char*, char, memory_order);
246char atomic_fetch_or_explicit(atomic_char*, char, memory_order);
247char atomic_fetch_xor(volatile atomic_char*, char);
248char atomic_fetch_xor(atomic_char*, char);
249char atomic_fetch_xor_explicit(volatile atomic_char*, char, memory_order);
250char atomic_fetch_xor_explicit(atomic_char*, char, memory_order);
251
252// atomic_schar
253
254typedef struct atomic_schar
255{
256 bool is_lock_free() const volatile;
257 bool is_lock_free() const;
258 void store(signed char, memory_order = memory_order_seq_cst) volatile;
259 void store(signed char, memory_order = memory_order_seq_cst);
260 signed char load(memory_order = memory_order_seq_cst) const volatile;
261 signed char load(memory_order = memory_order_seq_cst) const;
262 operator signed char() const volatile;
263 operator signed char() const;
264 signed char exchange(signed char,
Howard Hinnante7385012010-10-19 16:51:18 +0000265 memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +0000266 signed char exchange(signed char, memory_order = memory_order_seq_cst);
267 bool compare_exchange_weak(signed char&, signed char, memory_order,
268 memory_order) volatile;
269 bool compare_exchange_weak(signed char&, signed char, memory_order,
270 memory_order);
271 bool compare_exchange_strong(signed char&, signed char, memory_order,
272 memory_order) volatile;
273 bool compare_exchange_strong(signed char&, signed char, memory_order,
274 memory_order);
275 bool compare_exchange_weak(signed char&, signed char,
276 memory_order = memory_order_seq_cst) volatile;
277 bool compare_exchange_weak(signed char&, signed char,
278 memory_order = memory_order_seq_cst);
279 bool compare_exchange_strong(signed char&, signed char,
280 memory_order = memory_order_seq_cst) volatile;
281 bool compare_exchange_strong(signed char&, signed char,
282 memory_order = memory_order_seq_cst);
283 signed char fetch_add(signed char,
284 memory_order = memory_order_seq_cst) volatile;
285 signed char fetch_add(signed char, memory_order = memory_order_seq_cst);
286 signed char fetch_sub(signed char,
287 memory_order = memory_order_seq_cst) volatile;
288 signed char fetch_sub(signed char, memory_order = memory_order_seq_cst);
289 signed char fetch_and(signed char,
290 memory_order = memory_order_seq_cst) volatile;
291 signed char fetch_and(signed char, memory_order = memory_order_seq_cst);
292 signed char fetch_or(signed char,
293 memory_order = memory_order_seq_cst) volatile;
294 signed char fetch_or(signed char, memory_order = memory_order_seq_cst);
295 signed char fetch_xor(signed char,
296 memory_order = memory_order_seq_cst) volatile;
297 signed char fetch_xor(signed char, memory_order = memory_order_seq_cst);
298 atomic_schar() = default;
299 constexpr atomic_schar(signed char);
300 atomic_schar(const atomic_schar&) = delete;
301 atomic_schar& operator=(const atomic_schar&) = delete;
302 atomic_schar& operator=(const atomic_schar&) volatile = delete;
303 signed char operator=(signed char) volatile;
304 signed char operator=(signed char);
305 signed char operator++(int) volatile;
306 signed char operator++(int);
307 signed char operator--(int) volatile;
308 signed char operator--(int);
309 signed char operator++() volatile;
310 signed char operator++();
311 signed char operator--() volatile;
312 signed char operator--();
313 signed char operator+=(signed char) volatile;
314 signed char operator+=(signed char);
315 signed char operator-=(signed char) volatile;
316 signed char operator-=(signed char);
317 signed char operator&=(signed char) volatile;
318 signed char operator&=(signed char);
319 signed char operator|=(signed char) volatile;
320 signed char operator|=(signed char);
321 signed char operator^=(signed char) volatile;
322 signed char operator^=(signed char);
323} atomic_schar;
324
325bool atomic_is_lock_free(const volatile atomic_schar*);
326bool atomic_is_lock_free(const atomic_schar*);
Howard Hinnante7385012010-10-19 16:51:18 +0000327void atomic_init(volatile atomic_schar*, signed char);
328void atomic_init(atomic_schar*, signed char);
Howard Hinnant8f73c632010-09-27 21:17:38 +0000329void atomic_store(volatile atomic_schar*, signed char);
330void atomic_store(atomic_schar*, signed char);
331void atomic_store_explicit(volatile atomic_schar*, signed char, memory_order);
332void atomic_store_explicit(atomic_schar*, signed char, memory_order);
333signed char atomic_load(const volatile atomic_schar*);
334signed char atomic_load(const atomic_schar*);
335signed char atomic_load_explicit(const volatile atomic_schar*, memory_order);
336signed char atomic_load_explicit(const atomic_schar*, memory_order);
337signed char atomic_exchange(volatile atomic_schar*, signed char);
338signed char atomic_exchange(atomic_schar*, signed char);
339signed char atomic_exchange_explicit(volatile atomic_schar*, signed char,
340 memory_order);
341signed char atomic_exchange_explicit(atomic_schar*, signed char, memory_order);
342bool atomic_compare_exchange_weak(volatile atomic_schar*, signed char*,
343 signed char);
344bool atomic_compare_exchange_weak(atomic_schar*, signed char*, signed char);
345bool atomic_compare_exchange_strong(volatile atomic_schar*, signed char*,
346 signed char);
347bool atomic_compare_exchange_strong(atomic_schar*, signed char*, signed char);
348bool atomic_compare_exchange_weak_explicit(volatile atomic_schar*, signed char*,
349 signed char, memory_order,
350 memory_order);
351bool atomic_compare_exchange_weak_explicit(atomic_schar*, signed char*,
352 signed char, memory_order,
353 memory_order);
354bool atomic_compare_exchange_strong_explicit(volatile atomic_schar*,
355 signed char*, signed char,
356 memory_order, memory_order);
357bool atomic_compare_exchange_strong_explicit(atomic_schar*, signed char*,
358 signed char, memory_order, memory_order);
359signed char atomic_fetch_add(volatile atomic_schar*, signed char);
360signed char atomic_fetch_add(atomic_schar*, signed char);
361signed char atomic_fetch_add_explicit(volatile atomic_schar*, signed char,
362 memory_order);
363signed char atomic_fetch_add_explicit(atomic_schar*, signed char, memory_order);
364signed char atomic_fetch_sub(volatile atomic_schar*, signed char);
365signed char atomic_fetch_sub(atomic_schar*, signed char);
366signed char atomic_fetch_sub_explicit(volatile atomic_schar*, signed char,
367 memory_order);
368signed char atomic_fetch_sub_explicit(atomic_schar*, signed char, memory_order);
369signed char atomic_fetch_and(volatile atomic_schar*, signed char);
370signed char atomic_fetch_and(atomic_schar*, signed char);
371signed char atomic_fetch_and_explicit(volatile atomic_schar*, signed char,
372 memory_order);
373signed char atomic_fetch_and_explicit(atomic_schar*, signed char, memory_order);
374signed char atomic_fetch_or(volatile atomic_schar*, signed char);
375signed char atomic_fetch_or(atomic_schar*, signed char);
376signed char atomic_fetch_or_explicit(volatile atomic_schar*, signed char,
377 memory_order);
378signed char atomic_fetch_or_explicit(atomic_schar*, signed char, memory_order);
379signed char atomic_fetch_xor(volatile atomic_schar*, signed char);
380signed char atomic_fetch_xor(atomic_schar*, signed char);
381signed char atomic_fetch_xor_explicit(volatile atomic_schar*, signed char,
382 memory_order);
383signed char atomic_fetch_xor_explicit(atomic_schar*, signed char, memory_order);
384
385// atomic_uchar
386
387typedef struct atomic_uchar
388{
389 bool is_lock_free() const volatile;
390 bool is_lock_free() const;
391 void store(unsigned char, memory_order = memory_order_seq_cst) volatile;
392 void store(unsigned char, memory_order = memory_order_seq_cst);
393 unsigned char load(memory_order = memory_order_seq_cst) const volatile;
394 unsigned char load(memory_order = memory_order_seq_cst) const;
395 operator unsigned char() const volatile;
396 operator unsigned char() const;
397 unsigned char exchange(unsigned char,
Howard Hinnante7385012010-10-19 16:51:18 +0000398 memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +0000399 unsigned char exchange(unsigned char, memory_order = memory_order_seq_cst);
400 bool compare_exchange_weak(unsigned char&, unsigned char, memory_order,
401 memory_order) volatile;
402 bool compare_exchange_weak(unsigned char&, unsigned char, memory_order,
403 memory_order);
404 bool compare_exchange_strong(unsigned char&, unsigned char, memory_order,
405 memory_order) volatile;
406 bool compare_exchange_strong(unsigned char&, unsigned char, memory_order,
407 memory_order);
408 bool compare_exchange_weak(unsigned char&, unsigned char,
409 memory_order = memory_order_seq_cst) volatile;
410 bool compare_exchange_weak(unsigned char&, unsigned char,
411 memory_order = memory_order_seq_cst);
412 bool compare_exchange_strong(unsigned char&, unsigned char,
413 memory_order = memory_order_seq_cst) volatile;
414 bool compare_exchange_strong(unsigned char&, unsigned char,
415 memory_order = memory_order_seq_cst);
416 unsigned char fetch_add(unsigned char,
417 memory_order = memory_order_seq_cst) volatile;
418 unsigned char fetch_add(unsigned char, memory_order = memory_order_seq_cst);
419 unsigned char fetch_sub(unsigned char,
420 memory_order = memory_order_seq_cst) volatile;
421 unsigned char fetch_sub(unsigned char, memory_order = memory_order_seq_cst);
422 unsigned char fetch_and(unsigned char,
423 memory_order = memory_order_seq_cst) volatile;
424 unsigned char fetch_and(unsigned char, memory_order = memory_order_seq_cst);
425 unsigned char fetch_or(unsigned char,
426 memory_order = memory_order_seq_cst) volatile;
427 unsigned char fetch_or(unsigned char, memory_order = memory_order_seq_cst);
428 unsigned char fetch_xor(unsigned char,
429 memory_order = memory_order_seq_cst) volatile;
430 unsigned char fetch_xor(unsigned char, memory_order = memory_order_seq_cst);
431 atomic_uchar() = default;
432 constexpr atomic_uchar(unsigned char);
433 atomic_uchar(const atomic_uchar&) = delete;
434 atomic_uchar& operator=(const atomic_uchar&) = delete;
435 atomic_uchar& operator=(const atomic_uchar&) volatile = delete;
436 unsigned char operator=(unsigned char) volatile;
437 unsigned char operator=(unsigned char);
438 unsigned char operator++(int) volatile;
439 unsigned char operator++(int);
440 unsigned char operator--(int) volatile;
441 unsigned char operator--(int);
442 unsigned char operator++() volatile;
443 unsigned char operator++();
444 unsigned char operator--() volatile;
445 unsigned char operator--();
446 unsigned char operator+=(unsigned char) volatile;
447 unsigned char operator+=(unsigned char);
448 unsigned char operator-=(unsigned char) volatile;
449 unsigned char operator-=(unsigned char);
450 unsigned char operator&=(unsigned char) volatile;
451 unsigned char operator&=(unsigned char);
452 unsigned char operator|=(unsigned char) volatile;
453 unsigned char operator|=(unsigned char);
454 unsigned char operator^=(unsigned char) volatile;
455 unsigned char operator^=(unsigned char);
456} atomic_uchar;
457
458bool atomic_is_lock_free(const volatile atomic_uchar*);
459bool atomic_is_lock_free(const atomic_uchar*);
Howard Hinnante7385012010-10-19 16:51:18 +0000460void atomic_init(volatile atomic_uchar*, unsigned char);
461void atomic_init(atomic_uchar*, unsigned char);
Howard Hinnant8f73c632010-09-27 21:17:38 +0000462void atomic_store(volatile atomic_uchar*, unsigned char);
463void atomic_store(atomic_uchar*, unsigned char);
464void atomic_store_explicit(volatile atomic_uchar*, unsigned char, memory_order);
465void atomic_store_explicit(atomic_uchar*, unsigned char, memory_order);
466unsigned char atomic_load(const volatile atomic_uchar*);
467unsigned char atomic_load(const atomic_uchar*);
468unsigned char atomic_load_explicit(const volatile atomic_uchar*, memory_order);
469unsigned char atomic_load_explicit(const atomic_uchar*, memory_order);
470unsigned char atomic_exchange(volatile atomic_uchar*, unsigned char);
471unsigned char atomic_exchange(atomic_uchar*, unsigned char);
472unsigned char atomic_exchange_explicit(volatile atomic_uchar*, unsigned char,
473 memory_order);
474unsigned char atomic_exchange_explicit(atomic_uchar*, unsigned char,
475 memory_order);
476bool atomic_compare_exchange_weak(volatile atomic_uchar*, unsigned char*,
477 unsigned char);
478bool atomic_compare_exchange_weak(atomic_uchar*, unsigned char*, unsigned char);
479bool atomic_compare_exchange_strong(volatile atomic_uchar*, unsigned char*,
480 unsigned char);
481bool atomic_compare_exchange_strong(atomic_uchar*, unsigned char*,
482 unsigned char);
483bool atomic_compare_exchange_weak_explicit(volatile atomic_uchar*,
484 unsigned char*, unsigned char,
485 memory_order, memory_order);
486bool atomic_compare_exchange_weak_explicit(atomic_uchar*, unsigned char*,
487 unsigned char, memory_order,
488 memory_order);
489bool atomic_compare_exchange_strong_explicit(volatile atomic_uchar*,
490 unsigned char*, unsigned char,
491 memory_order, memory_order);
492bool atomic_compare_exchange_strong_explicit(atomic_uchar*, unsigned char*,
493 unsigned char, memory_order,
494 memory_order);
495unsigned char atomic_fetch_add(volatile atomic_uchar*, unsigned char);
496unsigned char atomic_fetch_add(atomic_uchar*, unsigned char);
497unsigned char atomic_fetch_add_explicit(volatile atomic_uchar*, unsigned char,
498 memory_order);
499unsigned char atomic_fetch_add_explicit(atomic_uchar*, unsigned char,
500 memory_order);
501unsigned char atomic_fetch_sub(volatile atomic_uchar*, unsigned char);
502unsigned char atomic_fetch_sub(atomic_uchar*, unsigned char);
503unsigned char atomic_fetch_sub_explicit(volatile atomic_uchar*, unsigned char,
504 memory_order);
505unsigned char atomic_fetch_sub_explicit(atomic_uchar*, unsigned char,
506 memory_order);
507unsigned char atomic_fetch_and(volatile atomic_uchar*, unsigned char);
508unsigned char atomic_fetch_and(atomic_uchar*, unsigned char);
509unsigned char atomic_fetch_and_explicit(volatile atomic_uchar*, unsigned char,
510 memory_order);
511unsigned char atomic_fetch_and_explicit(atomic_uchar*, unsigned char,
512 memory_order);
513unsigned char atomic_fetch_or(volatile atomic_uchar*, unsigned char);
514unsigned char atomic_fetch_or(atomic_uchar*, unsigned char);
515unsigned char atomic_fetch_or_explicit(volatile atomic_uchar*, unsigned char,
516 memory_order);
517unsigned char atomic_fetch_or_explicit(atomic_uchar*, unsigned char,
518 memory_order);
519unsigned char atomic_fetch_xor(volatile atomic_uchar*, unsigned char);
520unsigned char atomic_fetch_xor(atomic_uchar*, unsigned char);
521unsigned char atomic_fetch_xor_explicit(volatile atomic_uchar*, unsigned char,
522 memory_order);
523unsigned char atomic_fetch_xor_explicit(atomic_uchar*, unsigned char,
524 memory_order);
525
526// atomic_short
527
528typedef struct atomic_short
529{
530 bool is_lock_free() const volatile;
531 bool is_lock_free() const;
532 void store(short, memory_order = memory_order_seq_cst) volatile;
533 void store(short, memory_order = memory_order_seq_cst);
534 short load(memory_order = memory_order_seq_cst) const volatile;
535 short load(memory_order = memory_order_seq_cst) const;
536 operator short() const volatile;
537 operator short() const;
Howard Hinnante7385012010-10-19 16:51:18 +0000538 short exchange(short, memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +0000539 short exchange(short, memory_order = memory_order_seq_cst);
540 bool compare_exchange_weak(short&, short, memory_order,
541 memory_order) volatile;
542 bool compare_exchange_weak(short&, short, memory_order, memory_order);
543 bool compare_exchange_strong(short&, short, memory_order,
544 memory_order) volatile;
545 bool compare_exchange_strong(short&, short, memory_order, memory_order);
546 bool compare_exchange_weak(short&, short,
547 memory_order = memory_order_seq_cst) volatile;
548 bool compare_exchange_weak(short&, short,
549 memory_order = memory_order_seq_cst);
550 bool compare_exchange_strong(short&, short,
551 memory_order = memory_order_seq_cst) volatile;
552 bool compare_exchange_strong(short&, short,
553 memory_order = memory_order_seq_cst);
554 short fetch_add(short, memory_order = memory_order_seq_cst) volatile;
555 short fetch_add(short, memory_order = memory_order_seq_cst);
556 short fetch_sub(short, memory_order = memory_order_seq_cst) volatile;
557 short fetch_sub(short, memory_order = memory_order_seq_cst);
558 short fetch_and(short, memory_order = memory_order_seq_cst) volatile;
559 short fetch_and(short, memory_order = memory_order_seq_cst);
560 short fetch_or(short, memory_order = memory_order_seq_cst) volatile;
561 short fetch_or(short, memory_order = memory_order_seq_cst);
562 short fetch_xor(short, memory_order = memory_order_seq_cst) volatile;
563 short fetch_xor(short, memory_order = memory_order_seq_cst);
564 atomic_short() = default;
565 constexpr atomic_short(short);
566 atomic_short(const atomic_short&) = delete;
567 atomic_short& operator=(const atomic_short&) = delete;
568 atomic_short& operator=(const atomic_short&) volatile = delete;
569 short operator=(short) volatile;
570 short operator=(short);
571 short operator++(int) volatile;
572 short operator++(int);
573 short operator--(int) volatile;
574 short operator--(int);
575 short operator++() volatile;
576 short operator++();
577 short operator--() volatile;
578 short operator--();
579 short operator+=(short) volatile;
580 short operator+=(short);
581 short operator-=(short) volatile;
582 short operator-=(short);
583 short operator&=(short) volatile;
584 short operator&=(short);
585 short operator|=(short) volatile;
586 short operator|=(short);
587 short operator^=(short) volatile;
588 short operator^=(short);
589} atomic_short;
590
591bool atomic_is_lock_free(const volatile atomic_short*);
592bool atomic_is_lock_free(const atomic_short*);
Howard Hinnante7385012010-10-19 16:51:18 +0000593void atomic_init(volatile atomic_short*, short);
594void atomic_init(atomic_short*, short);
Howard Hinnant8f73c632010-09-27 21:17:38 +0000595void atomic_store(volatile atomic_short*, short);
596void atomic_store(atomic_short*, short);
597void atomic_store_explicit(volatile atomic_short*, short, memory_order);
598void atomic_store_explicit(atomic_short*, short, memory_order);
599short atomic_load(const volatile atomic_short*);
600short atomic_load(const atomic_short*);
601short atomic_load_explicit(const volatile atomic_short*, memory_order);
602short atomic_load_explicit(const atomic_short*, memory_order);
603short atomic_exchange(volatile atomic_short*, short);
604short atomic_exchange(atomic_short*, short);
605short atomic_exchange_explicit(volatile atomic_short*, short, memory_order);
606short atomic_exchange_explicit(atomic_short*, short, memory_order);
607bool atomic_compare_exchange_weak(volatile atomic_short*, short*, short);
608bool atomic_compare_exchange_weak(atomic_short*, short*, short);
609bool atomic_compare_exchange_strong(volatile atomic_short*, short*, short);
610bool atomic_compare_exchange_strong(atomic_short*, short*, short);
611bool atomic_compare_exchange_weak_explicit(volatile atomic_short*, short*,
612 short, memory_order, memory_order);
613bool atomic_compare_exchange_weak_explicit(atomic_short*, short*, short,
614 memory_order, memory_order);
615bool atomic_compare_exchange_strong_explicit(volatile atomic_short*, short*,
616 short, memory_order, memory_order);
617bool atomic_compare_exchange_strong_explicit(atomic_short*, short*, short,
618 memory_order, memory_order);
619short atomic_fetch_add(volatile atomic_short*, short);
620short atomic_fetch_add(atomic_short*, short);
621short atomic_fetch_add_explicit(volatile atomic_short*, short, memory_order);
622short atomic_fetch_add_explicit(atomic_short*, short, memory_order);
623short atomic_fetch_sub(volatile atomic_short*, short);
624short atomic_fetch_sub(atomic_short*, short);
625short atomic_fetch_sub_explicit(volatile atomic_short*, short, memory_order);
626short atomic_fetch_sub_explicit(atomic_short*, short, memory_order);
627short atomic_fetch_and(volatile atomic_short*, short);
628short atomic_fetch_and(atomic_short*, short);
629short atomic_fetch_and_explicit(volatile atomic_short*, short, memory_order);
630short atomic_fetch_and_explicit(atomic_short*, short, memory_order);
631short atomic_fetch_or(volatile atomic_short*, short);
632short atomic_fetch_or(atomic_short*, short);
633short atomic_fetch_or_explicit(volatile atomic_short*, short, memory_order);
634short atomic_fetch_or_explicit(atomic_short*, short, memory_order);
635short atomic_fetch_xor(volatile atomic_short*, short);
636short atomic_fetch_xor(atomic_short*, short);
637short atomic_fetch_xor_explicit(volatile atomic_short*, short, memory_order);
638short atomic_fetch_xor_explicit(atomic_short*, short, memory_order);
639
640// atomic_ushort
641
642typedef struct atomic_ushort
643{
644 bool is_lock_free() const volatile;
645 bool is_lock_free() const;
646 void store(unsigned short, memory_order = memory_order_seq_cst) volatile;
647 void store(unsigned short, memory_order = memory_order_seq_cst);
648 unsigned short load(memory_order = memory_order_seq_cst) const volatile;
649 unsigned short load(memory_order = memory_order_seq_cst) const;
650 operator unsigned short() const volatile;
651 operator unsigned short() const;
652 unsigned short exchange(unsigned short,
Howard Hinnante7385012010-10-19 16:51:18 +0000653 memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +0000654 unsigned short exchange(unsigned short,
655 memory_order = memory_order_seq_cst);
656 bool compare_exchange_weak(unsigned short&, unsigned short, memory_order,
657 memory_order) volatile;
658 bool compare_exchange_weak(unsigned short&, unsigned short, memory_order,
659 memory_order);
660 bool compare_exchange_strong(unsigned short&, unsigned short, memory_order,
661 memory_order) volatile;
662 bool compare_exchange_strong(unsigned short&, unsigned short, memory_order,
663 memory_order);
664 bool compare_exchange_weak(unsigned short&, unsigned short,
665 memory_order = memory_order_seq_cst) volatile;
666 bool compare_exchange_weak(unsigned short&, unsigned short,
667 memory_order = memory_order_seq_cst);
668 bool compare_exchange_strong(unsigned short&, unsigned short,
669 memory_order = memory_order_seq_cst) volatile;
670 bool compare_exchange_strong(unsigned short&, unsigned short,
671 memory_order = memory_order_seq_cst);
672 unsigned short fetch_add(unsigned short,
673 memory_order = memory_order_seq_cst) volatile;
674 unsigned short fetch_add(unsigned short,
675 memory_order = memory_order_seq_cst);
676 unsigned short fetch_sub(unsigned short,
677 memory_order = memory_order_seq_cst) volatile;
678 unsigned short fetch_sub(unsigned short,
679 memory_order = memory_order_seq_cst);
680 unsigned short fetch_and(unsigned short,
681 memory_order = memory_order_seq_cst) volatile;
682 unsigned short fetch_and(unsigned short,
683 memory_order = memory_order_seq_cst);
684 unsigned short fetch_or(unsigned short,
685 memory_order = memory_order_seq_cst) volatile;
686 unsigned short fetch_or(unsigned short,
687 memory_order = memory_order_seq_cst);
688 unsigned short fetch_xor(unsigned short,
689 memory_order = memory_order_seq_cst) volatile;
690 unsigned short fetch_xor(unsigned short,
691 memory_order = memory_order_seq_cst);
692 atomic_ushort() = default;
693 constexpr atomic_ushort(unsigned short);
694 atomic_ushort(const atomic_ushort&) = delete;
695 atomic_ushort& operator=(const atomic_ushort&) = delete;
696 atomic_ushort& operator=(const atomic_ushort&) volatile = delete;
697 unsigned short operator=(unsigned short) volatile;
698 unsigned short operator=(unsigned short);
699 unsigned short operator++(int) volatile;
700 unsigned short operator++(int);
701 unsigned short operator--(int) volatile;
702 unsigned short operator--(int);
703 unsigned short operator++() volatile;
704 unsigned short operator++();
705 unsigned short operator--() volatile;
706 unsigned short operator--();
707 unsigned short operator+=(unsigned short) volatile;
708 unsigned short operator+=(unsigned short);
709 unsigned short operator-=(unsigned short) volatile;
710 unsigned short operator-=(unsigned short);
711 unsigned short operator&=(unsigned short) volatile;
712 unsigned short operator&=(unsigned short);
713 unsigned short operator|=(unsigned short) volatile;
714 unsigned short operator|=(unsigned short);
715 unsigned short operator^=(unsigned short) volatile;
716 unsigned short operator^=(unsigned short);
717} atomic_ushort;
718
719bool atomic_is_lock_free(const volatile atomic_ushort*);
720bool atomic_is_lock_free(const atomic_ushort*);
Howard Hinnante7385012010-10-19 16:51:18 +0000721void atomic_init(volatile atomic_ushort*, unsigned short);
722void atomic_init(atomic_ushort*, unsigned short);
Howard Hinnant8f73c632010-09-27 21:17:38 +0000723void atomic_store(volatile atomic_ushort*, unsigned short);
724void atomic_store(atomic_ushort*, unsigned short);
725void atomic_store_explicit(volatile atomic_ushort*, unsigned short,
726 memory_order);
727void atomic_store_explicit(atomic_ushort*, unsigned short, memory_order);
728unsigned short atomic_load(const volatile atomic_ushort*);
729unsigned short atomic_load(const atomic_ushort*);
730unsigned short atomic_load_explicit(const volatile atomic_ushort*,
731 memory_order);
732unsigned short atomic_load_explicit(const atomic_ushort*, memory_order);
733unsigned short atomic_exchange(volatile atomic_ushort*, unsigned short);
734unsigned short atomic_exchange(atomic_ushort*, unsigned short);
735unsigned short atomic_exchange_explicit(volatile atomic_ushort*, unsigned short,
736 memory_order);
737unsigned short atomic_exchange_explicit(atomic_ushort*, unsigned short,
738 memory_order);
739bool atomic_compare_exchange_weak(volatile atomic_ushort*, unsigned short*,
740 unsigned short);
741bool atomic_compare_exchange_weak(atomic_ushort*, unsigned short*,
742 unsigned short);
743bool atomic_compare_exchange_strong(volatile atomic_ushort*, unsigned short*,
744 unsigned short);
745bool atomic_compare_exchange_strong(atomic_ushort*, unsigned short*,
746 unsigned short);
747bool atomic_compare_exchange_weak_explicit(volatile atomic_ushort*,
748 unsigned short*, unsigned short,
749 memory_order, memory_order);
750bool atomic_compare_exchange_weak_explicit(atomic_ushort*, unsigned short*,
751 unsigned short, memory_order,
752 memory_order);
753bool atomic_compare_exchange_strong_explicit(volatile atomic_ushort*,
754 unsigned short*, unsigned short,
755 memory_order, memory_order);
756bool atomic_compare_exchange_strong_explicit(atomic_ushort*, unsigned short*,
757 unsigned short, memory_order,
758 memory_order);
759unsigned short atomic_fetch_add(volatile atomic_ushort*, unsigned short);
760unsigned short atomic_fetch_add(atomic_ushort*, unsigned short);
761unsigned short atomic_fetch_add_explicit(volatile atomic_ushort*,
762 unsigned short, memory_order);
763unsigned short atomic_fetch_add_explicit(atomic_ushort*, unsigned short,
764 memory_order);
765unsigned short atomic_fetch_sub(volatile atomic_ushort*, unsigned short);
766unsigned short atomic_fetch_sub(atomic_ushort*, unsigned short);
767unsigned short atomic_fetch_sub_explicit(volatile atomic_ushort*,
768 unsigned short, memory_order);
769unsigned short atomic_fetch_sub_explicit(atomic_ushort*, unsigned short,
770 memory_order);
771unsigned short atomic_fetch_and(volatile atomic_ushort*, unsigned short);
772unsigned short atomic_fetch_and(atomic_ushort*, unsigned short);
773unsigned short atomic_fetch_and_explicit(volatile atomic_ushort*,
774 unsigned short, memory_order);
775unsigned short atomic_fetch_and_explicit(atomic_ushort*, unsigned short,
776 memory_order);
777unsigned short atomic_fetch_or(volatile atomic_ushort*, unsigned short);
778unsigned short atomic_fetch_or(atomic_ushort*, unsigned short);
779unsigned short atomic_fetch_or_explicit(volatile atomic_ushort*, unsigned short,
780 memory_order);
781unsigned short atomic_fetch_or_explicit(atomic_ushort*, unsigned short,
782 memory_order);
783unsigned short atomic_fetch_xor(volatile atomic_ushort*, unsigned short);
784unsigned short atomic_fetch_xor(atomic_ushort*, unsigned short);
785unsigned short atomic_fetch_xor_explicit(volatile atomic_ushort*,
786 unsigned short, memory_order);
787unsigned short atomic_fetch_xor_explicit(atomic_ushort*, unsigned short,
788 memory_order);
789
790// atomic_int
791
792typedef struct atomic_int
793{
794 bool is_lock_free() const volatile;
795 bool is_lock_free() const;
796 void store(int, memory_order = memory_order_seq_cst) volatile;
797 void store(int, memory_order = memory_order_seq_cst);
798 int load(memory_order = memory_order_seq_cst) const volatile;
799 int load(memory_order = memory_order_seq_cst) const;
800 operator int() const volatile;
801 operator int() const;
Howard Hinnante7385012010-10-19 16:51:18 +0000802 int exchange(int, memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +0000803 int exchange(int, memory_order = memory_order_seq_cst);
804 bool compare_exchange_weak(int&, int, memory_order, memory_order) volatile;
805 bool compare_exchange_weak(int&, int, memory_order, memory_order);
806 bool compare_exchange_strong(int&, int, memory_order,
807 memory_order) volatile;
808 bool compare_exchange_strong(int&, int, memory_order, memory_order);
809 bool compare_exchange_weak(int&, int,
810 memory_order = memory_order_seq_cst) volatile;
811 bool compare_exchange_weak(int&, int, memory_order = memory_order_seq_cst);
812 bool compare_exchange_strong(int&, int,
813 memory_order = memory_order_seq_cst) volatile;
814 bool compare_exchange_strong(int&, int,
815 memory_order = memory_order_seq_cst);
816 int fetch_add(int, memory_order = memory_order_seq_cst) volatile;
817 int fetch_add(int, memory_order = memory_order_seq_cst);
818 int fetch_sub(int, memory_order = memory_order_seq_cst) volatile;
819 int fetch_sub(int, memory_order = memory_order_seq_cst);
820 int fetch_and(int, memory_order = memory_order_seq_cst) volatile;
821 int fetch_and(int, memory_order = memory_order_seq_cst);
822 int fetch_or(int, memory_order = memory_order_seq_cst) volatile;
823 int fetch_or(int, memory_order = memory_order_seq_cst);
824 int fetch_xor(int, memory_order = memory_order_seq_cst) volatile;
825 int fetch_xor(int, memory_order = memory_order_seq_cst);
826 atomic_int() = default;
827 constexpr atomic_int(int);
828 atomic_int(const atomic_int&) = delete;
829 atomic_int& operator=(const atomic_int&) = delete;
830 atomic_int& operator=(const atomic_int&) volatile = delete;
831 int operator=(int) volatile;
832 int operator=(int);
833 int operator++(int) volatile;
834 int operator++(int);
835 int operator--(int) volatile;
836 int operator--(int);
837 int operator++() volatile;
838 int operator++();
839 int operator--() volatile;
840 int operator--();
841 int operator+=(int) volatile;
842 int operator+=(int);
843 int operator-=(int) volatile;
844 int operator-=(int);
845 int operator&=(int) volatile;
846 int operator&=(int);
847 int operator|=(int) volatile;
848 int operator|=(int);
849 int operator^=(int) volatile;
850 int operator^=(int);
851} atomic_int;
852
853bool atomic_is_lock_free(const volatile atomic_int*);
854bool atomic_is_lock_free(const atomic_int*);
Howard Hinnante7385012010-10-19 16:51:18 +0000855void atomic_init(volatile atomic_int*, int);
856void atomic_init(atomic_int*, int);
Howard Hinnant8f73c632010-09-27 21:17:38 +0000857void atomic_store(volatile atomic_int*, int);
858void atomic_store(atomic_int*, int);
859void atomic_store_explicit(volatile atomic_int*, int, memory_order);
860void atomic_store_explicit(atomic_int*, int, memory_order);
861int atomic_load(const volatile atomic_int*);
862int atomic_load(const atomic_int*);
863int atomic_load_explicit(const volatile atomic_int*, memory_order);
864int atomic_load_explicit(const atomic_int*, memory_order);
865int atomic_exchange(volatile atomic_int*, int);
866int atomic_exchange(atomic_int*, int);
867int atomic_exchange_explicit(volatile atomic_int*, int, memory_order);
868int atomic_exchange_explicit(atomic_int*, int, memory_order);
869bool atomic_compare_exchange_weak(volatile atomic_int*, int*, int);
870bool atomic_compare_exchange_weak(atomic_int*, int*, int);
871bool atomic_compare_exchange_strong(volatile atomic_int*, int*, int);
872bool atomic_compare_exchange_strong(atomic_int*, int*, int);
873bool atomic_compare_exchange_weak_explicit(volatile atomic_int*, int*, int,
874 memory_order, memory_order);
875bool atomic_compare_exchange_weak_explicit(atomic_int*, int*, int, memory_order,
876 memory_order);
877bool atomic_compare_exchange_strong_explicit(volatile atomic_int*, int*, int,
878 memory_order, memory_order);
879bool atomic_compare_exchange_strong_explicit(atomic_int*, int*, int,
880 memory_order, memory_order);
881int atomic_fetch_add(volatile atomic_int*, int);
882int atomic_fetch_add(atomic_int*, int);
883int atomic_fetch_add_explicit(volatile atomic_int*, int, memory_order);
884int atomic_fetch_add_explicit(atomic_int*, int, memory_order);
885int atomic_fetch_sub(volatile atomic_int*, int);
886int atomic_fetch_sub(atomic_int*, int);
887int atomic_fetch_sub_explicit(volatile atomic_int*, int, memory_order);
888int atomic_fetch_sub_explicit(atomic_int*, int, memory_order);
889int atomic_fetch_and(volatile atomic_int*, int);
890int atomic_fetch_and(atomic_int*, int);
891int atomic_fetch_and_explicit(volatile atomic_int*, int, memory_order);
892int atomic_fetch_and_explicit(atomic_int*, int, memory_order);
893int atomic_fetch_or(volatile atomic_int*, int);
894int atomic_fetch_or(atomic_int*, int);
895int atomic_fetch_or_explicit(volatile atomic_int*, int, memory_order);
896int atomic_fetch_or_explicit(atomic_int*, int, memory_order);
897int atomic_fetch_xor(volatile atomic_int*, int);
898int atomic_fetch_xor(atomic_int*, int);
899int atomic_fetch_xor_explicit(volatile atomic_int*, int, memory_order);
900int atomic_fetch_xor_explicit(atomic_int*, int, memory_order);
901
902// atomic_uint
903
904typedef struct atomic_uint
905{
906 bool is_lock_free() const volatile;
907 bool is_lock_free() const;
908 void store(unsigned int, memory_order = memory_order_seq_cst) volatile;
909 void store(unsigned int, memory_order = memory_order_seq_cst);
910 unsigned int load(memory_order = memory_order_seq_cst) const volatile;
911 unsigned int load(memory_order = memory_order_seq_cst) const;
912 operator unsigned int() const volatile;
913 operator unsigned int() const;
914 unsigned int exchange(unsigned int,
Howard Hinnante7385012010-10-19 16:51:18 +0000915 memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +0000916 unsigned int exchange(unsigned int, memory_order = memory_order_seq_cst);
917 bool compare_exchange_weak(unsigned int&, unsigned int, memory_order,
918 memory_order) volatile;
919 bool compare_exchange_weak(unsigned int&, unsigned int, memory_order,
920 memory_order);
921 bool compare_exchange_strong(unsigned int&, unsigned int, memory_order,
922 memory_order) volatile;
923 bool compare_exchange_strong(unsigned int&, unsigned int, memory_order,
924 memory_order);
925 bool compare_exchange_weak(unsigned int&, unsigned int,
926 memory_order = memory_order_seq_cst) volatile;
927 bool compare_exchange_weak(unsigned int&, unsigned int,
928 memory_order = memory_order_seq_cst);
929 bool compare_exchange_strong(unsigned int&, unsigned int,
930 memory_order = memory_order_seq_cst) volatile;
931 bool compare_exchange_strong(unsigned int&, unsigned int,
932 memory_order = memory_order_seq_cst);
933 unsigned int fetch_add(unsigned int,
934 memory_order = memory_order_seq_cst) volatile;
935 unsigned int fetch_add(unsigned int, memory_order = memory_order_seq_cst);
936 unsigned int fetch_sub(unsigned int,
937 memory_order = memory_order_seq_cst) volatile;
938 unsigned int fetch_sub(unsigned int, memory_order = memory_order_seq_cst);
939 unsigned int fetch_and(unsigned int,
940 memory_order = memory_order_seq_cst) volatile;
941 unsigned int fetch_and(unsigned int, memory_order = memory_order_seq_cst);
942 unsigned int fetch_or(unsigned int,
943 memory_order = memory_order_seq_cst) volatile;
944 unsigned int fetch_or(unsigned int, memory_order = memory_order_seq_cst);
945 unsigned int fetch_xor(unsigned int,
946 memory_order = memory_order_seq_cst) volatile;
947 unsigned int fetch_xor(unsigned int, memory_order = memory_order_seq_cst);
948 atomic_uint() = default;
949 constexpr atomic_uint(unsigned int);
950 atomic_uint(const atomic_uint&) = delete;
951 atomic_uint& operator=(const atomic_uint&) = delete;
952 atomic_uint& operator=(const atomic_uint&) volatile = delete;
953 unsigned int operator=(unsigned int) volatile;
954 unsigned int operator=(unsigned int);
955 unsigned int operator++(int) volatile;
956 unsigned int operator++(int);
957 unsigned int operator--(int) volatile;
958 unsigned int operator--(int);
959 unsigned int operator++() volatile;
960 unsigned int operator++();
961 unsigned int operator--() volatile;
962 unsigned int operator--();
963 unsigned int operator+=(unsigned int) volatile;
964 unsigned int operator+=(unsigned int);
965 unsigned int operator-=(unsigned int) volatile;
966 unsigned int operator-=(unsigned int);
967 unsigned int operator&=(unsigned int) volatile;
968 unsigned int operator&=(unsigned int);
969 unsigned int operator|=(unsigned int) volatile;
970 unsigned int operator|=(unsigned int);
971 unsigned int operator^=(unsigned int) volatile;
972 unsigned int operator^=(unsigned int);
973} atomic_uint;
974
975bool atomic_is_lock_free(const volatile atomic_uint*);
976bool atomic_is_lock_free(const atomic_uint*);
Howard Hinnante7385012010-10-19 16:51:18 +0000977void atomic_init(volatile atomic_uint*, unsigned int);
978void atomic_init(atomic_uint*, unsigned int);
Howard Hinnant8f73c632010-09-27 21:17:38 +0000979void atomic_store(volatile atomic_uint*, unsigned int);
980void atomic_store(atomic_uint*, unsigned int);
981void atomic_store_explicit(volatile atomic_uint*, unsigned int, memory_order);
982void atomic_store_explicit(atomic_uint*, unsigned int, memory_order);
983unsigned int atomic_load(const volatile atomic_uint*);
984unsigned int atomic_load(const atomic_uint*);
985unsigned int atomic_load_explicit(const volatile atomic_uint*, memory_order);
986unsigned int atomic_load_explicit(const atomic_uint*, memory_order);
987unsigned int atomic_exchange(volatile atomic_uint*, unsigned int);
988unsigned int atomic_exchange(atomic_uint*, unsigned int);
989unsigned int atomic_exchange_explicit(volatile atomic_uint*, unsigned int,
990 memory_order);
991unsigned int atomic_exchange_explicit(atomic_uint*, unsigned int, memory_order);
992bool atomic_compare_exchange_weak(volatile atomic_uint*, unsigned int*,
993 unsigned int);
994bool atomic_compare_exchange_weak(atomic_uint*, unsigned int*, unsigned int);
995bool atomic_compare_exchange_strong(volatile atomic_uint*, unsigned int*,
996 unsigned int);
997bool atomic_compare_exchange_strong(atomic_uint*, unsigned int*, unsigned int);
998bool atomic_compare_exchange_weak_explicit(volatile atomic_uint*, unsigned int*,
999 unsigned int, memory_order,
1000 memory_order);
1001bool atomic_compare_exchange_weak_explicit(atomic_uint*, unsigned int*,
1002 unsigned int, memory_order,
1003 memory_order);
1004bool atomic_compare_exchange_strong_explicit(volatile atomic_uint*,
1005 unsigned int*, unsigned int,
1006 memory_order, memory_order);
1007bool atomic_compare_exchange_strong_explicit(atomic_uint*, unsigned int*,
1008 unsigned int, memory_order,
1009 memory_order);
1010unsigned int atomic_fetch_add(volatile atomic_uint*, unsigned int);
1011unsigned int atomic_fetch_add(atomic_uint*, unsigned int);
1012unsigned int atomic_fetch_add_explicit(volatile atomic_uint*, unsigned int,
1013 memory_order);
1014unsigned int atomic_fetch_add_explicit(atomic_uint*, unsigned int,
1015 memory_order);
1016unsigned int atomic_fetch_sub(volatile atomic_uint*, unsigned int);
1017unsigned int atomic_fetch_sub(atomic_uint*, unsigned int);
1018unsigned int atomic_fetch_sub_explicit(volatile atomic_uint*, unsigned int,
1019 memory_order);
1020unsigned int atomic_fetch_sub_explicit(atomic_uint*, unsigned int,
1021 memory_order);
1022unsigned int atomic_fetch_and(volatile atomic_uint*, unsigned int);
1023unsigned int atomic_fetch_and(atomic_uint*, unsigned int);
1024unsigned int atomic_fetch_and_explicit(volatile atomic_uint*, unsigned int,
1025 memory_order);
1026unsigned int atomic_fetch_and_explicit(atomic_uint*, unsigned int,
1027 memory_order);
1028unsigned int atomic_fetch_or(volatile atomic_uint*, unsigned int);
1029unsigned int atomic_fetch_or(atomic_uint*, unsigned int);
1030unsigned int atomic_fetch_or_explicit(volatile atomic_uint*, unsigned int,
1031 memory_order);
1032unsigned int atomic_fetch_or_explicit(atomic_uint*, unsigned int, memory_order);
1033unsigned int atomic_fetch_xor(volatile atomic_uint*, unsigned int);
1034unsigned int atomic_fetch_xor(atomic_uint*, unsigned int);
1035unsigned int atomic_fetch_xor_explicit(volatile atomic_uint*, unsigned int,
1036 memory_order);
1037unsigned int atomic_fetch_xor_explicit(atomic_uint*, unsigned int,
1038 memory_order);
1039
1040// atomic_long
1041
1042typedef struct atomic_long
1043{
1044 bool is_lock_free() const volatile;
1045 bool is_lock_free() const;
1046 void store(long, memory_order = memory_order_seq_cst) volatile;
1047 void store(long, memory_order = memory_order_seq_cst);
1048 long load(memory_order = memory_order_seq_cst) const volatile;
1049 long load(memory_order = memory_order_seq_cst) const;
1050 operator long() const volatile;
1051 operator long() const;
Howard Hinnante7385012010-10-19 16:51:18 +00001052 long exchange(long, memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +00001053 long exchange(long, memory_order = memory_order_seq_cst);
1054 bool compare_exchange_weak(long&, long, memory_order,
1055 memory_order) volatile;
1056 bool compare_exchange_weak(long&, long, memory_order, memory_order);
1057 bool compare_exchange_strong(long&, long, memory_order,
1058 memory_order) volatile;
1059 bool compare_exchange_strong(long&, long, memory_order, memory_order);
1060 bool compare_exchange_weak(long&, long,
1061 memory_order = memory_order_seq_cst) volatile;
1062 bool compare_exchange_weak(long&, long,
1063 memory_order = memory_order_seq_cst);
1064 bool compare_exchange_strong(long&, long,
1065 memory_order = memory_order_seq_cst) volatile;
1066 bool compare_exchange_strong(long&, long,
1067 memory_order = memory_order_seq_cst);
1068 long fetch_add(long, memory_order = memory_order_seq_cst) volatile;
1069 long fetch_add(long, memory_order = memory_order_seq_cst);
1070 long fetch_sub(long, memory_order = memory_order_seq_cst) volatile;
1071 long fetch_sub(long, memory_order = memory_order_seq_cst);
1072 long fetch_and(long, memory_order = memory_order_seq_cst) volatile;
1073 long fetch_and(long, memory_order = memory_order_seq_cst);
1074 long fetch_or(long, memory_order = memory_order_seq_cst) volatile;
1075 long fetch_or(long, memory_order = memory_order_seq_cst);
1076 long fetch_xor(long, memory_order = memory_order_seq_cst) volatile;
1077 long fetch_xor(long, memory_order = memory_order_seq_cst);
1078 atomic_long() = default;
1079 constexpr atomic_long(long);
1080 atomic_long(const atomic_long&) = delete;
1081 atomic_long& operator=(const atomic_long&) = delete;
1082 atomic_long& operator=(const atomic_long&) volatile = delete;
1083 long operator=(long) volatile;
1084 long operator=(long);
1085 long operator++(int) volatile;
1086 long operator++(int);
1087 long operator--(int) volatile;
1088 long operator--(int);
1089 long operator++() volatile;
1090 long operator++();
1091 long operator--() volatile;
1092 long operator--();
1093 long operator+=(long) volatile;
1094 long operator+=(long);
1095 long operator-=(long) volatile;
1096 long operator-=(long);
1097 long operator&=(long) volatile;
1098 long operator&=(long);
1099 long operator|=(long) volatile;
1100 long operator|=(long);
1101 long operator^=(long) volatile;
1102 long operator^=(long);
1103} atomic_long;
1104
1105bool atomic_is_lock_free(const volatile atomic_long*);
1106bool atomic_is_lock_free(const atomic_long*);
Howard Hinnante7385012010-10-19 16:51:18 +00001107void atomic_init(volatile atomic_long*, long);
1108void atomic_init(atomic_long*, long);
Howard Hinnant8f73c632010-09-27 21:17:38 +00001109void atomic_store(volatile atomic_long*, long);
1110void atomic_store(atomic_long*, long);
1111void atomic_store_explicit(volatile atomic_long*, long, memory_order);
1112void atomic_store_explicit(atomic_long*, long, memory_order);
1113long atomic_load(const volatile atomic_long*);
1114long atomic_load(const atomic_long*);
1115long atomic_load_explicit(const volatile atomic_long*, memory_order);
1116long atomic_load_explicit(const atomic_long*, memory_order);
1117long atomic_exchange(volatile atomic_long*, long);
1118long atomic_exchange(atomic_long*, long);
1119long atomic_exchange_explicit(volatile atomic_long*, long, memory_order);
1120long atomic_exchange_explicit(atomic_long*, long, memory_order);
1121bool atomic_compare_exchange_weak(volatile atomic_long*, long*, long);
1122bool atomic_compare_exchange_weak(atomic_long*, long*, long);
1123bool atomic_compare_exchange_strong(volatile atomic_long*, long*, long);
1124bool atomic_compare_exchange_strong(atomic_long*, long*, long);
1125bool atomic_compare_exchange_weak_explicit(volatile atomic_long*, long*, long,
1126 memory_order, memory_order);
1127bool atomic_compare_exchange_weak_explicit(atomic_long*, long*, long,
1128 memory_order, memory_order);
1129bool atomic_compare_exchange_strong_explicit(volatile atomic_long*, long*, long,
1130 memory_order, memory_order);
1131bool atomic_compare_exchange_strong_explicit(atomic_long*, long*, long,
1132 memory_order, memory_order);
1133long atomic_fetch_add(volatile atomic_long*, long);
1134long atomic_fetch_add(atomic_long*, long);
1135long atomic_fetch_add_explicit(volatile atomic_long*, long, memory_order);
1136long atomic_fetch_add_explicit(atomic_long*, long, memory_order);
1137long atomic_fetch_sub(volatile atomic_long*, long);
1138long atomic_fetch_sub(atomic_long*, long);
1139long atomic_fetch_sub_explicit(volatile atomic_long*, long, memory_order);
1140long atomic_fetch_sub_explicit(atomic_long*, long, memory_order);
1141long atomic_fetch_and(volatile atomic_long*, long);
1142long atomic_fetch_and(atomic_long*, long);
1143long atomic_fetch_and_explicit(volatile atomic_long*, long, memory_order);
1144long atomic_fetch_and_explicit(atomic_long*, long, memory_order);
1145long atomic_fetch_or(volatile atomic_long*, long);
1146long atomic_fetch_or(atomic_long*, long);
1147long atomic_fetch_or_explicit(volatile atomic_long*, long, memory_order);
1148long atomic_fetch_or_explicit(atomic_long*, long, memory_order);
1149long atomic_fetch_xor(volatile atomic_long*, long);
1150long atomic_fetch_xor(atomic_long*, long);
1151long atomic_fetch_xor_explicit(volatile atomic_long*, long, memory_order);
1152long atomic_fetch_xor_explicit(atomic_long*, long, memory_order);
1153
1154// atomic_ulong
1155
1156typedef struct atomic_ulong
1157{
1158 bool is_lock_free() const volatile;
1159 bool is_lock_free() const;
1160 void store(unsigned long, memory_order = memory_order_seq_cst) volatile;
1161 void store(unsigned long, memory_order = memory_order_seq_cst);
1162 unsigned long load(memory_order = memory_order_seq_cst) const volatile;
1163 unsigned long load(memory_order = memory_order_seq_cst) const;
1164 operator unsigned long() const volatile;
1165 operator unsigned long() const;
1166 unsigned long exchange(unsigned long,
Howard Hinnante7385012010-10-19 16:51:18 +00001167 memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +00001168 unsigned long exchange(unsigned long, memory_order = memory_order_seq_cst);
1169 bool compare_exchange_weak(unsigned long&, unsigned long, memory_order,
1170 memory_order) volatile;
1171 bool compare_exchange_weak(unsigned long&, unsigned long, memory_order,
1172 memory_order);
1173 bool compare_exchange_strong(unsigned long&, unsigned long, memory_order,
1174 memory_order) volatile;
1175 bool compare_exchange_strong(unsigned long&, unsigned long, memory_order,
1176 memory_order);
1177 bool compare_exchange_weak(unsigned long&, unsigned long,
1178 memory_order = memory_order_seq_cst) volatile;
1179 bool compare_exchange_weak(unsigned long&, unsigned long,
1180 memory_order = memory_order_seq_cst);
1181 bool compare_exchange_strong(unsigned long&, unsigned long,
1182 memory_order = memory_order_seq_cst) volatile;
1183 bool compare_exchange_strong(unsigned long&, unsigned long,
1184 memory_order = memory_order_seq_cst);
1185 unsigned long fetch_add(unsigned long,
1186 memory_order = memory_order_seq_cst) volatile;
1187 unsigned long fetch_add(unsigned long, memory_order = memory_order_seq_cst);
1188 unsigned long fetch_sub(unsigned long,
1189 memory_order = memory_order_seq_cst) volatile;
1190 unsigned long fetch_sub(unsigned long, memory_order = memory_order_seq_cst);
1191 unsigned long fetch_and(unsigned long,
1192 memory_order = memory_order_seq_cst) volatile;
1193 unsigned long fetch_and(unsigned long, memory_order = memory_order_seq_cst);
1194 unsigned long fetch_or(unsigned long,
1195 memory_order = memory_order_seq_cst) volatile;
1196 unsigned long fetch_or(unsigned long, memory_order = memory_order_seq_cst);
1197 unsigned long fetch_xor(unsigned long,
1198 memory_order = memory_order_seq_cst) volatile;
1199 unsigned long fetch_xor(unsigned long, memory_order = memory_order_seq_cst);
1200 atomic_ulong() = default;
1201 constexpr atomic_ulong(unsigned long);
1202 atomic_ulong(const atomic_ulong&) = delete;
1203 atomic_ulong& operator=(const atomic_ulong&) = delete;
1204 atomic_ulong& operator=(const atomic_ulong&) volatile = delete;
1205 unsigned long operator=(unsigned long) volatile;
1206 unsigned long operator=(unsigned long);
1207 unsigned long operator++(int) volatile;
1208 unsigned long operator++(int);
1209 unsigned long operator--(int) volatile;
1210 unsigned long operator--(int);
1211 unsigned long operator++() volatile;
1212 unsigned long operator++();
1213 unsigned long operator--() volatile;
1214 unsigned long operator--();
1215 unsigned long operator+=(unsigned long) volatile;
1216 unsigned long operator+=(unsigned long);
1217 unsigned long operator-=(unsigned long) volatile;
1218 unsigned long operator-=(unsigned long);
1219 unsigned long operator&=(unsigned long) volatile;
1220 unsigned long operator&=(unsigned long);
1221 unsigned long operator|=(unsigned long) volatile;
1222 unsigned long operator|=(unsigned long);
1223 unsigned long operator^=(unsigned long) volatile;
1224 unsigned long operator^=(unsigned long);
1225} atomic_ulong;
1226
1227bool atomic_is_lock_free(const volatile atomic_ulong*);
1228bool atomic_is_lock_free(const atomic_ulong*);
Howard Hinnante7385012010-10-19 16:51:18 +00001229void atomic_init(volatile atomic_ulong*, unsigned long);
1230void atomic_init(atomic_ulong*, unsigned long);
Howard Hinnant8f73c632010-09-27 21:17:38 +00001231void atomic_store(volatile atomic_ulong*, unsigned long);
1232void atomic_store(atomic_ulong*, unsigned long);
1233void atomic_store_explicit(volatile atomic_ulong*, unsigned long, memory_order);
1234void atomic_store_explicit(atomic_ulong*, unsigned long, memory_order);
1235unsigned long atomic_load(const volatile atomic_ulong*);
1236unsigned long atomic_load(const atomic_ulong*);
1237unsigned long atomic_load_explicit(const volatile atomic_ulong*, memory_order);
1238unsigned long atomic_load_explicit(const atomic_ulong*, memory_order);
1239unsigned long atomic_exchange(volatile atomic_ulong*, unsigned long);
1240unsigned long atomic_exchange(atomic_ulong*, unsigned long);
1241unsigned long atomic_exchange_explicit(volatile atomic_ulong*, unsigned long,
1242 memory_order);
1243unsigned long atomic_exchange_explicit(atomic_ulong*, unsigned long,
1244 memory_order);
1245bool atomic_compare_exchange_weak(volatile atomic_ulong*, unsigned long*,
1246 unsigned long);
1247bool atomic_compare_exchange_weak(atomic_ulong*, unsigned long*, unsigned long);
1248bool atomic_compare_exchange_strong(volatile atomic_ulong*, unsigned long*,
1249 unsigned long);
1250bool atomic_compare_exchange_strong(atomic_ulong*, unsigned long*,
1251 unsigned long);
1252bool atomic_compare_exchange_weak_explicit(volatile atomic_ulong*,
1253 unsigned long*, unsigned long,
1254 memory_order, memory_order);
1255bool atomic_compare_exchange_weak_explicit(atomic_ulong*, unsigned long*,
1256 unsigned long, memory_order,
1257 memory_order);
1258bool atomic_compare_exchange_strong_explicit(volatile atomic_ulong*,
1259 unsigned long*, unsigned long,
1260 memory_order, memory_order);
1261bool atomic_compare_exchange_strong_explicit(atomic_ulong*, unsigned long*,
1262 unsigned long, memory_order,
1263 memory_order);
1264unsigned long atomic_fetch_add(volatile atomic_ulong*, unsigned long);
1265unsigned long atomic_fetch_add(atomic_ulong*, unsigned long);
1266unsigned long atomic_fetch_add_explicit(volatile atomic_ulong*, unsigned long,
1267 memory_order);
1268unsigned long atomic_fetch_add_explicit(atomic_ulong*, unsigned long,
1269 memory_order);
1270unsigned long atomic_fetch_sub(volatile atomic_ulong*, unsigned long);
1271unsigned long atomic_fetch_sub(atomic_ulong*, unsigned long);
1272unsigned long atomic_fetch_sub_explicit(volatile atomic_ulong*, unsigned long,
1273 memory_order);
1274unsigned long atomic_fetch_sub_explicit(atomic_ulong*, unsigned long,
1275 memory_order);
1276unsigned long atomic_fetch_and(volatile atomic_ulong*, unsigned long);
1277unsigned long atomic_fetch_and(atomic_ulong*, unsigned long);
1278unsigned long atomic_fetch_and_explicit(volatile atomic_ulong*, unsigned long,
1279 memory_order);
1280unsigned long atomic_fetch_and_explicit(atomic_ulong*, unsigned long,
1281 memory_order);
1282unsigned long atomic_fetch_or(volatile atomic_ulong*, unsigned long);
1283unsigned long atomic_fetch_or(atomic_ulong*, unsigned long);
1284unsigned long atomic_fetch_or_explicit(volatile atomic_ulong*, unsigned long,
1285 memory_order);
1286unsigned long atomic_fetch_or_explicit(atomic_ulong*, unsigned long,
1287 memory_order);
1288unsigned long atomic_fetch_xor(volatile atomic_ulong*, unsigned long);
1289unsigned long atomic_fetch_xor(atomic_ulong*, unsigned long);
1290unsigned long atomic_fetch_xor_explicit(volatile atomic_ulong*, unsigned long,
1291 memory_order);
1292unsigned long atomic_fetch_xor_explicit(atomic_ulong*, unsigned long,
1293 memory_order);
1294
1295// atomic_llong
1296
1297typedef struct atomic_llong
1298{
1299 bool is_lock_free() const volatile;
1300 bool is_lock_free() const;
1301 void store(long long, memory_order = memory_order_seq_cst) volatile;
1302 void store(long long, memory_order = memory_order_seq_cst);
1303 long long load(memory_order = memory_order_seq_cst) const volatile;
1304 long long load(memory_order = memory_order_seq_cst) const;
1305 operator long long() const volatile;
1306 operator long long() const;
Howard Hinnante7385012010-10-19 16:51:18 +00001307 long long exchange(long long, memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +00001308 long long exchange(long long, memory_order = memory_order_seq_cst);
1309 bool compare_exchange_weak(long long&, long long, memory_order,
1310 memory_order) volatile;
1311 bool compare_exchange_weak(long long&, long long, memory_order,
1312 memory_order);
1313 bool compare_exchange_strong(long long&, long long, memory_order,
1314 memory_order) volatile;
1315 bool compare_exchange_strong(long long&, long long, memory_order,
1316 memory_order);
1317 bool compare_exchange_weak(long long&, long long,
1318 memory_order = memory_order_seq_cst) volatile;
1319 bool compare_exchange_weak(long long&, long long,
1320 memory_order = memory_order_seq_cst);
1321 bool compare_exchange_strong(long long&, long long,
1322 memory_order = memory_order_seq_cst) volatile;
1323 bool compare_exchange_strong(long long&, long long,
1324 memory_order = memory_order_seq_cst);
1325 long long fetch_add(long long,
1326 memory_order = memory_order_seq_cst) volatile;
1327 long long fetch_add(long long, memory_order = memory_order_seq_cst);
1328 long long fetch_sub(long long,
1329 memory_order = memory_order_seq_cst) volatile;
1330 long long fetch_sub(long long, memory_order = memory_order_seq_cst);
1331 long long fetch_and(long long,
1332 memory_order = memory_order_seq_cst) volatile;
1333 long long fetch_and(long long, memory_order = memory_order_seq_cst);
1334 long long fetch_or(long long, memory_order = memory_order_seq_cst) volatile;
1335 long long fetch_or(long long, memory_order = memory_order_seq_cst);
1336 long long fetch_xor(long long,
1337 memory_order = memory_order_seq_cst) volatile;
1338 long long fetch_xor(long long, memory_order = memory_order_seq_cst);
1339 atomic_llong() = default;
1340 constexpr atomic_llong(long long);
1341 atomic_llong(const atomic_llong&) = delete;
1342 atomic_llong& operator=(const atomic_llong&) = delete;
1343 atomic_llong& operator=(const atomic_llong&) volatile = delete;
1344 long long operator=(long long) volatile;
1345 long long operator=(long long);
1346 long long operator++(int) volatile;
1347 long long operator++(int);
1348 long long operator--(int) volatile;
1349 long long operator--(int);
1350 long long operator++() volatile;
1351 long long operator++();
1352 long long operator--() volatile;
1353 long long operator--();
1354 long long operator+=(long long) volatile;
1355 long long operator+=(long long);
1356 long long operator-=(long long) volatile;
1357 long long operator-=(long long);
1358 long long operator&=(long long) volatile;
1359 long long operator&=(long long);
1360 long long operator|=(long long) volatile;
1361 long long operator|=(long long);
1362 long long operator^=(long long) volatile;
1363 long long operator^=(long long);
1364} atomic_llong;
1365
1366bool atomic_is_lock_free(const volatile atomic_llong*);
1367bool atomic_is_lock_free(const atomic_llong*);
Howard Hinnante7385012010-10-19 16:51:18 +00001368void atomic_init(volatile atomic_llong*, long long);
1369void atomic_init(atomic_llong*, long long);
Howard Hinnant8f73c632010-09-27 21:17:38 +00001370void atomic_store(volatile atomic_llong*, long long);
1371void atomic_store(atomic_llong*, long long);
1372void atomic_store_explicit(volatile atomic_llong*, long long, memory_order);
1373void atomic_store_explicit(atomic_llong*, long long, memory_order);
1374long long atomic_load(const volatile atomic_llong*);
1375long long atomic_load(const atomic_llong*);
1376long long atomic_load_explicit(const volatile atomic_llong*, memory_order);
1377long long atomic_load_explicit(const atomic_llong*, memory_order);
1378long long atomic_exchange(volatile atomic_llong*, long long);
1379long long atomic_exchange(atomic_llong*, long long);
1380long long atomic_exchange_explicit(volatile atomic_llong*, long long,
1381 memory_order);
1382long long atomic_exchange_explicit(atomic_llong*, long long, memory_order);
1383bool atomic_compare_exchange_weak(volatile atomic_llong*, long long*,
1384 long long);
1385bool atomic_compare_exchange_weak(atomic_llong*, long long*, long long);
1386bool atomic_compare_exchange_strong(volatile atomic_llong*, long long*,
1387 long long);
1388bool atomic_compare_exchange_strong(atomic_llong*, long long*, long long);
1389bool atomic_compare_exchange_weak_explicit(volatile atomic_llong*, long long*,
1390 long long, memory_order,
1391 memory_order);
1392bool atomic_compare_exchange_weak_explicit(atomic_llong*, long long*, long long,
1393 memory_order, memory_order);
1394bool atomic_compare_exchange_strong_explicit(volatile atomic_llong*, long long*,
1395 long long, memory_order,
1396 memory_order);
1397bool atomic_compare_exchange_strong_explicit(atomic_llong*, long long*,
1398 long long, memory_order,
1399 memory_order);
1400long long atomic_fetch_add(volatile atomic_llong*, long long);
1401long long atomic_fetch_add(atomic_llong*, long long);
1402long long atomic_fetch_add_explicit(volatile atomic_llong*, long long,
1403 memory_order);
1404long long atomic_fetch_add_explicit(atomic_llong*, long long, memory_order);
1405long long atomic_fetch_sub(volatile atomic_llong*, long long);
1406long long atomic_fetch_sub(atomic_llong*, long long);
1407long long atomic_fetch_sub_explicit(volatile atomic_llong*, long long,
1408 memory_order);
1409long long atomic_fetch_sub_explicit(atomic_llong*, long long, memory_order);
1410long long atomic_fetch_and(volatile atomic_llong*, long long);
1411long long atomic_fetch_and(atomic_llong*, long long);
1412long long atomic_fetch_and_explicit(volatile atomic_llong*, long long,
1413 memory_order);
1414long long atomic_fetch_and_explicit(atomic_llong*, long long, memory_order);
1415long long atomic_fetch_or(volatile atomic_llong*, long long);
1416long long atomic_fetch_or(atomic_llong*, long long);
1417long long atomic_fetch_or_explicit(volatile atomic_llong*, long long,
1418 memory_order);
1419long long atomic_fetch_or_explicit(atomic_llong*, long long, memory_order);
1420long long atomic_fetch_xor(volatile atomic_llong*, long long);
1421long long atomic_fetch_xor(atomic_llong*, long long);
1422long long atomic_fetch_xor_explicit(volatile atomic_llong*, long long,
1423 memory_order);
1424long long atomic_fetch_xor_explicit(atomic_llong*, long long, memory_order);
1425
1426// atomic_ullong
1427
1428typedef struct atomic_ullong
1429{
1430 bool is_lock_free() const volatile;
1431 bool is_lock_free() const;
1432 void store(unsigned long long,
1433 memory_order = memory_order_seq_cst) volatile;
1434 void store(unsigned long long, memory_order = memory_order_seq_cst);
1435 unsigned long long load(memory_order = memory_order_seq_cst) const volatile;
1436 unsigned long long load(memory_order = memory_order_seq_cst) const;
1437 operator unsigned long long() const volatile;
1438 operator unsigned long long() const;
1439 unsigned long long exchange(unsigned long long,
Howard Hinnante7385012010-10-19 16:51:18 +00001440 memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +00001441 unsigned long long exchange(unsigned long long,
1442 memory_order = memory_order_seq_cst);
1443 bool compare_exchange_weak(unsigned long long&, unsigned long long,
1444 memory_order, memory_order) volatile;
1445 bool compare_exchange_weak(unsigned long long&, unsigned long long,
1446 memory_order, memory_order);
1447 bool compare_exchange_strong(unsigned long long&, unsigned long long,
1448 memory_order, memory_order) volatile;
1449 bool compare_exchange_strong(unsigned long long&, unsigned long long,
1450 memory_order, memory_order);
1451 bool compare_exchange_weak(unsigned long long&, unsigned long long,
1452 memory_order = memory_order_seq_cst) volatile;
1453 bool compare_exchange_weak(unsigned long long&, unsigned long long,
1454 memory_order = memory_order_seq_cst);
1455 bool compare_exchange_strong(unsigned long long&, unsigned long long,
1456 memory_order = memory_order_seq_cst) volatile;
1457 bool compare_exchange_strong(unsigned long long&, unsigned long long,
1458 memory_order = memory_order_seq_cst);
1459 unsigned long long fetch_add(unsigned long long,
1460 memory_order = memory_order_seq_cst) volatile;
1461 unsigned long long fetch_add(unsigned long long,
1462 memory_order = memory_order_seq_cst);
1463 unsigned long long fetch_sub(unsigned long long,
1464 memory_order = memory_order_seq_cst) volatile;
1465 unsigned long long fetch_sub(unsigned long long,
1466 memory_order = memory_order_seq_cst);
1467 unsigned long long fetch_and(unsigned long long,
1468 memory_order = memory_order_seq_cst) volatile;
1469 unsigned long long fetch_and(unsigned long long,
1470 memory_order = memory_order_seq_cst);
1471 unsigned long long fetch_or(unsigned long long,
1472 memory_order = memory_order_seq_cst) volatile;
1473 unsigned long long fetch_or(unsigned long long,
1474 memory_order = memory_order_seq_cst);
1475 unsigned long long fetch_xor(unsigned long long,
1476 memory_order = memory_order_seq_cst) volatile;
1477 unsigned long long fetch_xor(unsigned long long,
1478 memory_order = memory_order_seq_cst);
1479 atomic_ullong() = default;
1480 constexpr atomic_ullong(unsigned long long);
1481 atomic_ullong(const atomic_ullong&) = delete;
1482 atomic_ullong& operator=(const atomic_ullong&) = delete;
1483 atomic_ullong& operator=(const atomic_ullong&) volatile = delete;
1484 unsigned long long operator=(unsigned long long) volatile;
1485 unsigned long long operator=(unsigned long long);
1486 unsigned long long operator++(int) volatile;
1487 unsigned long long operator++(int);
1488 unsigned long long operator--(int) volatile;
1489 unsigned long long operator--(int);
1490 unsigned long long operator++() volatile;
1491 unsigned long long operator++();
1492 unsigned long long operator--() volatile;
1493 unsigned long long operator--();
1494 unsigned long long operator+=(unsigned long long) volatile;
1495 unsigned long long operator+=(unsigned long long);
1496 unsigned long long operator-=(unsigned long long) volatile;
1497 unsigned long long operator-=(unsigned long long);
1498 unsigned long long operator&=(unsigned long long) volatile;
1499 unsigned long long operator&=(unsigned long long);
1500 unsigned long long operator|=(unsigned long long) volatile;
1501 unsigned long long operator|=(unsigned long long);
1502 unsigned long long operator^=(unsigned long long) volatile;
1503 unsigned long long operator^=(unsigned long long);
1504} atomic_ullong;
1505
1506bool atomic_is_lock_free(const volatile atomic_ullong*);
1507bool atomic_is_lock_free(const atomic_ullong*);
Howard Hinnante7385012010-10-19 16:51:18 +00001508void atomic_init(volatile atomic_ullong*, unsigned long long);
1509void atomic_init(atomic_ullong*, unsigned long long);
Howard Hinnant8f73c632010-09-27 21:17:38 +00001510void atomic_store(volatile atomic_ullong*, unsigned long long);
1511void atomic_store(atomic_ullong*, unsigned long long);
1512void atomic_store_explicit(volatile atomic_ullong*, unsigned long long,
1513 memory_order);
1514void atomic_store_explicit(atomic_ullong*, unsigned long long, memory_order);
1515unsigned long long atomic_load(const volatile atomic_ullong*);
1516unsigned long long atomic_load(const atomic_ullong*);
1517unsigned long long atomic_load_explicit(const volatile atomic_ullong*,
1518 memory_order);
1519unsigned long long atomic_load_explicit(const atomic_ullong*, memory_order);
1520unsigned long long atomic_exchange(volatile atomic_ullong*, unsigned long long);
1521unsigned long long atomic_exchange(atomic_ullong*, unsigned long long);
1522unsigned long long atomic_exchange_explicit(volatile atomic_ullong*,
1523 unsigned long long, memory_order);
1524unsigned long long atomic_exchange_explicit(atomic_ullong*, unsigned long long,
1525 memory_order);
1526bool atomic_compare_exchange_weak(volatile atomic_ullong*, unsigned long long*,
1527 unsigned long long);
1528bool atomic_compare_exchange_weak(atomic_ullong*, unsigned long long*,
1529 unsigned long long);
1530bool atomic_compare_exchange_strong(volatile atomic_ullong*,
1531 unsigned long long*, unsigned long long);
1532bool atomic_compare_exchange_strong(atomic_ullong*, unsigned long long*,
1533 unsigned long long);
1534bool atomic_compare_exchange_weak_explicit(volatile atomic_ullong*,
1535 unsigned long long*,
1536 unsigned long long, memory_order,
1537 memory_order);
1538bool atomic_compare_exchange_weak_explicit(atomic_ullong*, unsigned long long*,
1539 unsigned long long, memory_order,
1540 memory_order);
1541bool atomic_compare_exchange_strong_explicit(volatile atomic_ullong*,
1542 unsigned long long*,
1543 unsigned long long, memory_order,
1544 memory_order);
1545bool atomic_compare_exchange_strong_explicit(atomic_ullong*,
1546 unsigned long long*,
1547 unsigned long long, memory_order,
1548 memory_order);
1549unsigned long long atomic_fetch_add(volatile atomic_ullong*,
1550 unsigned long long);
1551unsigned long long atomic_fetch_add(atomic_ullong*, unsigned long long);
1552unsigned long long atomic_fetch_add_explicit(volatile atomic_ullong*,
1553 unsigned long long, memory_order);
1554unsigned long long atomic_fetch_add_explicit(atomic_ullong*, unsigned long long,
1555 memory_order);
1556unsigned long long atomic_fetch_sub(volatile atomic_ullong*,
1557 unsigned long long);
1558unsigned long long atomic_fetch_sub(atomic_ullong*, unsigned long long);
1559unsigned long long atomic_fetch_sub_explicit(volatile atomic_ullong*,
1560 unsigned long long, memory_order);
1561unsigned long long atomic_fetch_sub_explicit(atomic_ullong*, unsigned long long,
1562 memory_order);
1563unsigned long long atomic_fetch_and(volatile atomic_ullong*,
1564 unsigned long long);
1565unsigned long long atomic_fetch_and(atomic_ullong*, unsigned long long);
1566unsigned long long atomic_fetch_and_explicit(volatile atomic_ullong*,
1567 unsigned long long, memory_order);
1568unsigned long long atomic_fetch_and_explicit(atomic_ullong*, unsigned long long,
1569 memory_order);
1570unsigned long long atomic_fetch_or(volatile atomic_ullong*, unsigned long long);
1571unsigned long long atomic_fetch_or(atomic_ullong*, unsigned long long);
1572unsigned long long atomic_fetch_or_explicit(volatile atomic_ullong*,
1573 unsigned long long, memory_order);
1574unsigned long long atomic_fetch_or_explicit(atomic_ullong*, unsigned long long,
1575 memory_order);
1576unsigned long long atomic_fetch_xor(volatile atomic_ullong*,
1577 unsigned long long);
1578unsigned long long atomic_fetch_xor(atomic_ullong*, unsigned long long);
1579unsigned long long atomic_fetch_xor_explicit(volatile atomic_ullong*,
1580 unsigned long long, memory_order);
1581unsigned long long atomic_fetch_xor_explicit(atomic_ullong*, unsigned long long,
1582 memory_order);
1583
1584// atomic_char16_t
1585
1586typedef struct atomic_char16_t
1587{
1588 bool is_lock_free() const volatile;
1589 bool is_lock_free() const;
1590 void store(char16_t, memory_order = memory_order_seq_cst) volatile;
1591 void store(char16_t, memory_order = memory_order_seq_cst);
1592 char16_t load(memory_order = memory_order_seq_cst) const volatile;
1593 char16_t load(memory_order = memory_order_seq_cst) const;
1594 operator char16_t() const volatile;
1595 operator char16_t() const;
Howard Hinnante7385012010-10-19 16:51:18 +00001596 char16_t exchange(char16_t, memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +00001597 char16_t exchange(char16_t, memory_order = memory_order_seq_cst);
1598 bool compare_exchange_weak(char16_t&, char16_t, memory_order,
1599 memory_order) volatile;
1600 bool compare_exchange_weak(char16_t&, char16_t, memory_order, memory_order);
1601 bool compare_exchange_strong(char16_t&, char16_t, memory_order,
1602 memory_order) volatile;
1603 bool compare_exchange_strong(char16_t&, char16_t,
1604 memory_order, memory_order);
1605 bool compare_exchange_weak(char16_t&, char16_t,
1606 memory_order = memory_order_seq_cst) volatile;
1607 bool compare_exchange_weak(char16_t&, char16_t,
1608 memory_order = memory_order_seq_cst);
1609 bool compare_exchange_strong(char16_t&, char16_t,
1610 memory_order = memory_order_seq_cst) volatile;
1611 bool compare_exchange_strong(char16_t&, char16_t,
1612 memory_order = memory_order_seq_cst);
1613 char16_t fetch_add(char16_t, memory_order = memory_order_seq_cst) volatile;
1614 char16_t fetch_add(char16_t, memory_order = memory_order_seq_cst);
1615 char16_t fetch_sub(char16_t, memory_order = memory_order_seq_cst) volatile;
1616 char16_t fetch_sub(char16_t, memory_order = memory_order_seq_cst);
1617 char16_t fetch_and(char16_t, memory_order = memory_order_seq_cst) volatile;
1618 char16_t fetch_and(char16_t, memory_order = memory_order_seq_cst);
1619 char16_t fetch_or(char16_t, memory_order = memory_order_seq_cst) volatile;
1620 char16_t fetch_or(char16_t, memory_order = memory_order_seq_cst);
1621 char16_t fetch_xor(char16_t, memory_order = memory_order_seq_cst) volatile;
1622 char16_t fetch_xor(char16_t, memory_order = memory_order_seq_cst);
1623 atomic_char16_t() = default;
1624 constexpr atomic_char16_t(char16_t);
1625 atomic_char16_t(const atomic_char16_t&) = delete;
1626 atomic_char16_t& operator=(const atomic_char16_t&) = delete;
1627 atomic_char16_t& operator=(const atomic_char16_t&) volatile = delete;
1628 char16_t operator=(char16_t) volatile;
1629 char16_t operator=(char16_t);
1630 char16_t operator++(int) volatile;
1631 char16_t operator++(int);
1632 char16_t operator--(int) volatile;
1633 char16_t operator--(int);
1634 char16_t operator++() volatile;
1635 char16_t operator++();
1636 char16_t operator--() volatile;
1637 char16_t operator--();
1638 char16_t operator+=(char16_t) volatile;
1639 char16_t operator+=(char16_t);
1640 char16_t operator-=(char16_t) volatile;
1641 char16_t operator-=(char16_t);
1642 char16_t operator&=(char16_t) volatile;
1643 char16_t operator&=(char16_t);
1644 char16_t operator|=(char16_t) volatile;
1645 char16_t operator|=(char16_t);
1646 char16_t operator^=(char16_t) volatile;
1647 char16_t operator^=(char16_t);
1648} atomic_char16_t;
1649
1650bool atomic_is_lock_free(const volatile atomic_char16_t*);
1651bool atomic_is_lock_free(const atomic_char16_t*);
Howard Hinnante7385012010-10-19 16:51:18 +00001652void atomic_init(volatile atomic_char16_t*, char16_t);
1653void atomic_init(atomic_char16_t*, char16_t);
Howard Hinnant8f73c632010-09-27 21:17:38 +00001654void atomic_store(volatile atomic_char16_t*, char16_t);
1655void atomic_store(atomic_char16_t*, char16_t);
1656void atomic_store_explicit(volatile atomic_char16_t*, char16_t, memory_order);
1657void atomic_store_explicit(atomic_char16_t*, char16_t, memory_order);
1658char16_t atomic_load(const volatile atomic_char16_t*);
1659char16_t atomic_load(const atomic_char16_t*);
1660char16_t atomic_load_explicit(const volatile atomic_char16_t*, memory_order);
1661char16_t atomic_load_explicit(const atomic_char16_t*, memory_order);
1662char16_t atomic_exchange(volatile atomic_char16_t*, char16_t);
1663char16_t atomic_exchange(atomic_char16_t*, char16_t);
1664char16_t atomic_exchange_explicit(volatile atomic_char16_t*, char16_t,
1665 memory_order);
1666char16_t atomic_exchange_explicit(atomic_char16_t*, char16_t, memory_order);
1667bool atomic_compare_exchange_weak(volatile atomic_char16_t*, char16_t*,
1668 char16_t);
1669bool atomic_compare_exchange_weak(atomic_char16_t*, char16_t*, char16_t);
1670bool atomic_compare_exchange_strong(volatile atomic_char16_t*, char16_t*,
1671 char16_t);
1672bool atomic_compare_exchange_strong(atomic_char16_t*, char16_t*, char16_t);
1673bool atomic_compare_exchange_weak_explicit(volatile atomic_char16_t*, char16_t*,
1674 char16_t, memory_order,
1675 memory_order);
1676bool atomic_compare_exchange_weak_explicit(atomic_char16_t*, char16_t*,
1677 char16_t, memory_order,
1678 memory_order);
1679bool atomic_compare_exchange_strong_explicit(volatile atomic_char16_t*,
1680 char16_t*, char16_t, memory_order,
1681 memory_order);
1682bool atomic_compare_exchange_strong_explicit(atomic_char16_t*, char16_t*,
1683 char16_t, memory_order,
1684 memory_order);
1685char16_t atomic_fetch_add(volatile atomic_char16_t*, char16_t);
1686char16_t atomic_fetch_add(atomic_char16_t*, char16_t);
1687char16_t atomic_fetch_add_explicit(volatile atomic_char16_t*, char16_t,
1688 memory_order);
1689char16_t atomic_fetch_add_explicit(atomic_char16_t*, char16_t, memory_order);
1690char16_t atomic_fetch_sub(volatile atomic_char16_t*, char16_t);
1691char16_t atomic_fetch_sub(atomic_char16_t*, char16_t);
1692char16_t atomic_fetch_sub_explicit(volatile atomic_char16_t*, char16_t,
1693 memory_order);
1694char16_t atomic_fetch_sub_explicit(atomic_char16_t*, char16_t, memory_order);
1695char16_t atomic_fetch_and(volatile atomic_char16_t*, char16_t);
1696char16_t atomic_fetch_and(atomic_char16_t*, char16_t);
1697char16_t atomic_fetch_and_explicit(volatile atomic_char16_t*, char16_t,
1698 memory_order);
1699char16_t atomic_fetch_and_explicit(atomic_char16_t*, char16_t, memory_order);
1700char16_t atomic_fetch_or(volatile atomic_char16_t*, char16_t);
1701char16_t atomic_fetch_or(atomic_char16_t*, char16_t);
1702char16_t atomic_fetch_or_explicit(volatile atomic_char16_t*, char16_t,
1703 memory_order);
1704char16_t atomic_fetch_or_explicit(atomic_char16_t*, char16_t, memory_order);
1705char16_t atomic_fetch_xor(volatile atomic_char16_t*, char16_t);
1706char16_t atomic_fetch_xor(atomic_char16_t*, char16_t);
1707char16_t atomic_fetch_xor_explicit(volatile atomic_char16_t*, char16_t,
1708 memory_order);
1709char16_t atomic_fetch_xor_explicit(atomic_char16_t*, char16_t, memory_order);
1710
1711// atomic_char32_t
1712
1713typedef struct atomic_char32_t
1714{
1715 bool is_lock_free() const volatile;
1716 bool is_lock_free() const;
1717 void store(char32_t, memory_order = memory_order_seq_cst) volatile;
1718 void store(char32_t, memory_order = memory_order_seq_cst);
1719 char32_t load(memory_order = memory_order_seq_cst) const volatile;
1720 char32_t load(memory_order = memory_order_seq_cst) const;
1721 operator char32_t() const volatile;
1722 operator char32_t() const;
Howard Hinnante7385012010-10-19 16:51:18 +00001723 char32_t exchange(char32_t, memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +00001724 char32_t exchange(char32_t, memory_order = memory_order_seq_cst);
1725 bool compare_exchange_weak(char32_t&, char32_t, memory_order,
1726 memory_order) volatile;
1727 bool compare_exchange_weak(char32_t&, char32_t, memory_order, memory_order);
1728 bool compare_exchange_strong(char32_t&, char32_t, memory_order,
1729 memory_order) volatile;
1730 bool compare_exchange_strong(char32_t&, char32_t,
1731 memory_order, memory_order);
1732 bool compare_exchange_weak(char32_t&, char32_t,
1733 memory_order = memory_order_seq_cst) volatile;
1734 bool compare_exchange_weak(char32_t&, char32_t,
1735 memory_order = memory_order_seq_cst);
1736 bool compare_exchange_strong(char32_t&, char32_t,
1737 memory_order = memory_order_seq_cst) volatile;
1738 bool compare_exchange_strong(char32_t&, char32_t,
1739 memory_order = memory_order_seq_cst);
1740 char32_t fetch_add(char32_t, memory_order = memory_order_seq_cst) volatile;
1741 char32_t fetch_add(char32_t, memory_order = memory_order_seq_cst);
1742 char32_t fetch_sub(char32_t, memory_order = memory_order_seq_cst) volatile;
1743 char32_t fetch_sub(char32_t, memory_order = memory_order_seq_cst);
1744 char32_t fetch_and(char32_t, memory_order = memory_order_seq_cst) volatile;
1745 char32_t fetch_and(char32_t, memory_order = memory_order_seq_cst);
1746 char32_t fetch_or(char32_t, memory_order = memory_order_seq_cst) volatile;
1747 char32_t fetch_or(char32_t, memory_order = memory_order_seq_cst);
1748 char32_t fetch_xor(char32_t, memory_order = memory_order_seq_cst) volatile;
1749 char32_t fetch_xor(char32_t, memory_order = memory_order_seq_cst);
1750 atomic_char32_t() = default;
1751 constexpr atomic_char32_t(char32_t);
1752 atomic_char32_t(const atomic_char32_t&) = delete;
1753 atomic_char32_t& operator=(const atomic_char32_t&) = delete;
1754 atomic_char32_t& operator=(const atomic_char32_t&) volatile = delete;
1755 char32_t operator=(char32_t) volatile;
1756 char32_t operator=(char32_t);
1757 char32_t operator++(int) volatile;
1758 char32_t operator++(int);
1759 char32_t operator--(int) volatile;
1760 char32_t operator--(int);
1761 char32_t operator++() volatile;
1762 char32_t operator++();
1763 char32_t operator--() volatile;
1764 char32_t operator--();
1765 char32_t operator+=(char32_t) volatile;
1766 char32_t operator+=(char32_t);
1767 char32_t operator-=(char32_t) volatile;
1768 char32_t operator-=(char32_t);
1769 char32_t operator&=(char32_t) volatile;
1770 char32_t operator&=(char32_t);
1771 char32_t operator|=(char32_t) volatile;
1772 char32_t operator|=(char32_t);
1773 char32_t operator^=(char32_t) volatile;
1774 char32_t operator^=(char32_t);
1775} atomic_char32_t;
1776
1777bool atomic_is_lock_free(const volatile atomic_char32_t*);
1778bool atomic_is_lock_free(const atomic_char32_t*);
Howard Hinnante7385012010-10-19 16:51:18 +00001779void atomic_init(volatile atomic_char32_t*, char32_t);
1780void atomic_init(atomic_char32_t*, char32_t);
Howard Hinnant8f73c632010-09-27 21:17:38 +00001781void atomic_store(volatile atomic_char32_t*, char32_t);
1782void atomic_store(atomic_char32_t*, char32_t);
1783void atomic_store_explicit(volatile atomic_char32_t*, char32_t, memory_order);
1784void atomic_store_explicit(atomic_char32_t*, char32_t, memory_order);
1785char32_t atomic_load(const volatile atomic_char32_t*);
1786char32_t atomic_load(const atomic_char32_t*);
1787char32_t atomic_load_explicit(const volatile atomic_char32_t*, memory_order);
1788char32_t atomic_load_explicit(const atomic_char32_t*, memory_order);
1789char32_t atomic_exchange(volatile atomic_char32_t*, char32_t);
1790char32_t atomic_exchange(atomic_char32_t*, char32_t);
1791char32_t atomic_exchange_explicit(volatile atomic_char32_t*, char32_t,
1792 memory_order);
1793char32_t atomic_exchange_explicit(atomic_char32_t*, char32_t, memory_order);
1794bool atomic_compare_exchange_weak(volatile atomic_char32_t*, char32_t*,
1795 char32_t);
1796bool atomic_compare_exchange_weak(atomic_char32_t*, char32_t*, char32_t);
1797bool atomic_compare_exchange_strong(volatile atomic_char32_t*, char32_t*,
1798 char32_t);
1799bool atomic_compare_exchange_strong(atomic_char32_t*, char32_t*, char32_t);
1800bool atomic_compare_exchange_weak_explicit(volatile atomic_char32_t*, char32_t*,
1801 char32_t, memory_order,
1802 memory_order);
1803bool atomic_compare_exchange_weak_explicit(atomic_char32_t*, char32_t*,
1804 char32_t, memory_order,
1805 memory_order);
1806bool atomic_compare_exchange_strong_explicit(volatile atomic_char32_t*,
1807 char32_t*, char32_t, memory_order,
1808 memory_order);
1809bool atomic_compare_exchange_strong_explicit(atomic_char32_t*, char32_t*,
1810 char32_t, memory_order,
1811 memory_order);
1812char32_t atomic_fetch_add(volatile atomic_char32_t*, char32_t);
1813char32_t atomic_fetch_add(atomic_char32_t*, char32_t);
1814char32_t atomic_fetch_add_explicit(volatile atomic_char32_t*, char32_t,
1815 memory_order);
1816char32_t atomic_fetch_add_explicit(atomic_char32_t*, char32_t, memory_order);
1817char32_t atomic_fetch_sub(volatile atomic_char32_t*, char32_t);
1818char32_t atomic_fetch_sub(atomic_char32_t*, char32_t);
1819char32_t atomic_fetch_sub_explicit(volatile atomic_char32_t*, char32_t,
1820 memory_order);
1821char32_t atomic_fetch_sub_explicit(atomic_char32_t*, char32_t, memory_order);
1822char32_t atomic_fetch_and(volatile atomic_char32_t*, char32_t);
1823char32_t atomic_fetch_and(atomic_char32_t*, char32_t);
1824char32_t atomic_fetch_and_explicit(volatile atomic_char32_t*, char32_t,
1825 memory_order);
1826char32_t atomic_fetch_and_explicit(atomic_char32_t*, char32_t, memory_order);
1827char32_t atomic_fetch_or(volatile atomic_char32_t*, char32_t);
1828char32_t atomic_fetch_or(atomic_char32_t*, char32_t);
1829char32_t atomic_fetch_or_explicit(volatile atomic_char32_t*, char32_t,
1830 memory_order);
1831char32_t atomic_fetch_or_explicit(atomic_char32_t*, char32_t, memory_order);
1832char32_t atomic_fetch_xor(volatile atomic_char32_t*, char32_t);
1833char32_t atomic_fetch_xor(atomic_char32_t*, char32_t);
1834char32_t atomic_fetch_xor_explicit(volatile atomic_char32_t*, char32_t,
1835 memory_order);
1836char32_t atomic_fetch_xor_explicit(atomic_char32_t*, char32_t, memory_order);
1837
1838// atomic_wchar_t
1839
1840typedef struct atomic_wchar_t
1841{
1842 bool is_lock_free() const volatile;
1843 bool is_lock_free() const;
1844 void store(wchar_t, memory_order = memory_order_seq_cst) volatile;
1845 void store(wchar_t, memory_order = memory_order_seq_cst);
1846 wchar_t load(memory_order = memory_order_seq_cst) const volatile;
1847 wchar_t load(memory_order = memory_order_seq_cst) const;
1848 operator wchar_t() const volatile;
1849 operator wchar_t() const;
Howard Hinnante7385012010-10-19 16:51:18 +00001850 wchar_t exchange(wchar_t, memory_order = memory_order_seq_cst) volatile;
Howard Hinnant8f73c632010-09-27 21:17:38 +00001851 wchar_t exchange(wchar_t, memory_order = memory_order_seq_cst);
1852 bool compare_exchange_weak(wchar_t&, wchar_t, memory_order,
1853 memory_order) volatile;
1854 bool compare_exchange_weak(wchar_t&, wchar_t, memory_order, memory_order);
1855 bool compare_exchange_strong(wchar_t&, wchar_t, memory_order,
1856 memory_order) volatile;
1857 bool compare_exchange_strong(wchar_t&, wchar_t, memory_order, memory_order);
1858 bool compare_exchange_weak(wchar_t&, wchar_t,
1859 memory_order = memory_order_seq_cst) volatile;
1860 bool compare_exchange_weak(wchar_t&, wchar_t,
1861 memory_order = memory_order_seq_cst);
1862 bool compare_exchange_strong(wchar_t&, wchar_t,
1863 memory_order = memory_order_seq_cst) volatile;
1864 bool compare_exchange_strong(wchar_t&, wchar_t,
1865 memory_order = memory_order_seq_cst);
1866 wchar_t fetch_add(wchar_t, memory_order = memory_order_seq_cst) volatile;
1867 wchar_t fetch_add(wchar_t, memory_order = memory_order_seq_cst);
1868 wchar_t fetch_sub(wchar_t, memory_order = memory_order_seq_cst) volatile;
1869 wchar_t fetch_sub(wchar_t, memory_order = memory_order_seq_cst);
1870 wchar_t fetch_and(wchar_t, memory_order = memory_order_seq_cst) volatile;
1871 wchar_t fetch_and(wchar_t, memory_order = memory_order_seq_cst);
1872 wchar_t fetch_or(wchar_t, memory_order = memory_order_seq_cst) volatile;
1873 wchar_t fetch_or(wchar_t, memory_order = memory_order_seq_cst);
1874 wchar_t fetch_xor(wchar_t, memory_order = memory_order_seq_cst) volatile;
1875 wchar_t fetch_xor(wchar_t, memory_order = memory_order_seq_cst);
1876 atomic_wchar_t() = default;
1877 constexpr atomic_wchar_t(wchar_t);
1878 atomic_wchar_t(const atomic_wchar_t&) = delete;
1879 atomic_wchar_t& operator=(const atomic_wchar_t&) = delete;
1880 atomic_wchar_t& operator=(const atomic_wchar_t&) volatile = delete;
1881 wchar_t operator=(wchar_t) volatile;
1882 wchar_t operator=(wchar_t);
1883 wchar_t operator++(int) volatile;
1884 wchar_t operator++(int);
1885 wchar_t operator--(int) volatile;
1886 wchar_t operator--(int);
1887 wchar_t operator++() volatile;
1888 wchar_t operator++();
1889 wchar_t operator--() volatile;
1890 wchar_t operator--();
1891 wchar_t operator+=(wchar_t) volatile;
1892 wchar_t operator+=(wchar_t);
1893 wchar_t operator-=(wchar_t) volatile;
1894 wchar_t operator-=(wchar_t);
1895 wchar_t operator&=(wchar_t) volatile;
1896 wchar_t operator&=(wchar_t);
1897 wchar_t operator|=(wchar_t) volatile;
1898 wchar_t operator|=(wchar_t);
1899 wchar_t operator^=(wchar_t) volatile;
1900 wchar_t operator^=(wchar_t);
1901} atomic_wchar_t;
1902
1903bool atomic_is_lock_free(const volatile atomic_wchar_t*);
1904bool atomic_is_lock_free(const atomic_wchar_t*);
Howard Hinnante7385012010-10-19 16:51:18 +00001905void atomic_init(volatile atomic_wchar_t*, wchar_t);
1906void atomic_init(atomic_wchar_t*, wchar_t);
Howard Hinnant8f73c632010-09-27 21:17:38 +00001907void atomic_store(volatile atomic_wchar_t*, wchar_t);
1908void atomic_store(atomic_wchar_t*, wchar_t);
1909void atomic_store_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
1910void atomic_store_explicit(atomic_wchar_t*, wchar_t, memory_order);
1911wchar_t atomic_load(const volatile atomic_wchar_t*);
1912wchar_t atomic_load(const atomic_wchar_t*);
1913wchar_t atomic_load_explicit(const volatile atomic_wchar_t*, memory_order);
1914wchar_t atomic_load_explicit(const atomic_wchar_t*, memory_order);
1915wchar_t atomic_exchange(volatile atomic_wchar_t*, wchar_t);
1916wchar_t atomic_exchange(atomic_wchar_t*, wchar_t);
1917wchar_t atomic_exchange_explicit(volatile atomic_wchar_t*,
1918 wchar_t, memory_order);
1919wchar_t atomic_exchange_explicit(atomic_wchar_t*, wchar_t, memory_order);
1920bool atomic_compare_exchange_weak(volatile atomic_wchar_t*, wchar_t*, wchar_t);
1921bool atomic_compare_exchange_weak(atomic_wchar_t*, wchar_t*, wchar_t);
1922bool atomic_compare_exchange_strong(volatile atomic_wchar_t*, wchar_t*,
1923 wchar_t);
1924bool atomic_compare_exchange_strong(atomic_wchar_t*, wchar_t*, wchar_t);
1925bool atomic_compare_exchange_weak_explicit(volatile atomic_wchar_t*, wchar_t*,
1926 wchar_t, memory_order, memory_order);
1927bool atomic_compare_exchange_weak_explicit(atomic_wchar_t*, wchar_t*, wchar_t,
1928 memory_order, memory_order);
1929bool atomic_compare_exchange_strong_explicit(volatile atomic_wchar_t*, wchar_t*,
1930 wchar_t, memory_order,
1931 memory_order);
1932bool atomic_compare_exchange_strong_explicit(atomic_wchar_t*, wchar_t*, wchar_t,
1933 memory_order, memory_order);
1934wchar_t atomic_fetch_add(volatile atomic_wchar_t*, wchar_t);
1935wchar_t atomic_fetch_add(atomic_wchar_t*, wchar_t);
1936wchar_t atomic_fetch_add_explicit(volatile atomic_wchar_t*, wchar_t,
1937 memory_order);
1938wchar_t atomic_fetch_add_explicit(atomic_wchar_t*, wchar_t, memory_order);
1939wchar_t atomic_fetch_sub(volatile atomic_wchar_t*, wchar_t);
1940wchar_t atomic_fetch_sub(atomic_wchar_t*, wchar_t);
1941wchar_t atomic_fetch_sub_explicit(volatile atomic_wchar_t*, wchar_t,
1942 memory_order);
1943wchar_t atomic_fetch_sub_explicit(atomic_wchar_t*, wchar_t, memory_order);
1944wchar_t atomic_fetch_and(volatile atomic_wchar_t*, wchar_t);
1945wchar_t atomic_fetch_and(atomic_wchar_t*, wchar_t);
1946wchar_t atomic_fetch_and_explicit(volatile atomic_wchar_t*, wchar_t,
1947 memory_order);
1948wchar_t atomic_fetch_and_explicit(atomic_wchar_t*, wchar_t, memory_order);
1949wchar_t atomic_fetch_or(volatile atomic_wchar_t*, wchar_t);
1950wchar_t atomic_fetch_or(atomic_wchar_t*, wchar_t);
1951wchar_t atomic_fetch_or_explicit(volatile atomic_wchar_t*, wchar_t,
1952 memory_order);
1953wchar_t atomic_fetch_or_explicit(atomic_wchar_t*, wchar_t, memory_order);
1954wchar_t atomic_fetch_xor(volatile atomic_wchar_t*, wchar_t);
1955wchar_t atomic_fetch_xor(atomic_wchar_t*, wchar_t);
1956wchar_t atomic_fetch_xor_explicit(volatile atomic_wchar_t*, wchar_t,
1957 memory_order);
1958wchar_t atomic_fetch_xor_explicit(atomic_wchar_t*, wchar_t, memory_order);
1959
1960// Atomics for standard typedef types
1961
1962typedef atomic_schar atomic_int_least8_t;
1963typedef atomic_uchar atomic_uint_least8_t;
1964typedef atomic_short atomic_int_least16_t;
1965typedef atomic_ushort atomic_uint_least16_t;
1966typedef atomic_int atomic_int_least32_t;
1967typedef atomic_uint atomic_uint_least32_t;
1968typedef atomic_llong atomic_int_least64_t;
1969typedef atomic_ullong atomic_uint_least64_t;
1970
1971typedef atomic_schar atomic_int_fast8_t;
1972typedef atomic_uchar atomic_uint_fast8_t;
1973typedef atomic_short atomic_int_fast16_t;
1974typedef atomic_ushort atomic_uint_fast16_t;
1975typedef atomic_int atomic_int_fast32_t;
1976typedef atomic_uint atomic_uint_fast32_t;
1977typedef atomic_llong atomic_int_fast64_t;
1978typedef atomic_ullong atomic_uint_fast64_t;
1979
1980typedef atomic_long atomic_intptr_t;
1981typedef atomic_ulong atomic_uintptr_t;
1982typedef atomic_ulong atomic_size_t;
1983typedef atomic_long atomic_ptrdiff_t;
1984typedef atomic_llong atomic_intmax_t;
1985typedef atomic_ullong atomic_uintmax_t;
1986
1987// address types
1988
1989typedef struct atomic_address
1990{
1991 bool is_lock_free() const volatile;
1992 bool is_lock_free() const;
1993 void store(void*, memory_order = memory_order_seq_cst) volatile;
1994 void store(void*, memory_order = memory_order_seq_cst);
1995 void* load(memory_order = memory_order_seq_cst) const volatile;
1996 void* load(memory_order = memory_order_seq_cst) const;
1997 operator void*() const volatile;
1998 operator void*() const;
1999 void* exchange(void*, memory_order = memory_order_seq_cst) volatile;
2000 void* exchange(void*, memory_order = memory_order_seq_cst);
2001 bool compare_exchange_weak(void*&, void*, memory_order,
2002 memory_order) volatile;
2003 bool compare_exchange_weak(void*&, void*, memory_order, memory_order);
2004 bool compare_exchange_strong(void*&, void*, memory_order,
2005 memory_order) volatile;
2006 bool compare_exchange_strong(void*&, void*, memory_order, memory_order);
2007 bool compare_exchange_weak(void*&, void*,
2008 memory_order = memory_order_seq_cst) volatile;
2009 bool compare_exchange_weak(void*&, void*,
2010 memory_order = memory_order_seq_cst);
2011 bool compare_exchange_strong(void*&, void*,
2012 memory_order = memory_order_seq_cst) volatile;
2013 bool compare_exchange_strong(void*&, void*,
2014 memory_order = memory_order_seq_cst);
2015 bool compare_exchange_weak(const void*&, const void*,
2016 memory_order, memory_order) volatile;
2017 bool compare_exchange_weak(const void*&, const void*, memory_order,
2018 memory_order);
2019 bool compare_exchange_strong(const void*&, const void*, memory_order,
2020 memory_order) volatile;
2021 bool compare_exchange_strong(const void*&, const void*, memory_order,
2022 memory_order);
2023 bool compare_exchange_weak(const void*&, const void*,
2024 memory_order = memory_order_seq_cst) volatile;
2025 bool compare_exchange_weak(const void*&, const void*,
2026 memory_order = memory_order_seq_cst);
2027 bool compare_exchange_strong(const void*&, const void*,
2028 memory_order = memory_order_seq_cst) volatile;
2029 bool compare_exchange_strong(const void*&, const void*,
2030 memory_order = memory_order_seq_cst);
2031 void* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
2032 void* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst);
2033 void* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
2034 void* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst);
2035 atomic_address() = default;
2036 constexpr atomic_address(void*);
2037 atomic_address(const atomic_address&) = delete;
2038 atomic_address& operator=(const atomic_address&) = delete;
2039 atomic_address& operator=(const atomic_address&) volatile = delete;
2040 void* operator=(const void*) volatile;
2041 void* operator=(const void*);
2042 void* operator+=(ptrdiff_t) volatile;
2043 void* operator+=(ptrdiff_t);
2044 void* operator-=(ptrdiff_t) volatile;
2045 void* operator-=(ptrdiff_t);
2046} atomic_address;
2047
2048bool atomic_is_lock_free(const volatile atomic_address*);
2049bool atomic_is_lock_free(const atomic_address*);
2050void atomic_init(volatile atomic_address*, void*);
2051void atomic_init(atomic_address*, void*);
2052void atomic_store(volatile atomic_address*, void*);
2053void atomic_store(atomic_address*, void*);
2054void atomic_store_explicit(volatile atomic_address*, void*, memory_order);
2055void atomic_store_explicit(atomic_address*, void*, memory_order);
2056void* atomic_load(const volatile atomic_address*);
2057void* atomic_load(const atomic_address*);
2058void* atomic_load_explicit(const volatile atomic_address*, memory_order);
2059void* atomic_load_explicit(const atomic_address*, memory_order);
2060void* atomic_exchange(volatile atomic_address*, void*);
2061void* atomic_exchange(atomic_address*, void*);
2062void* atomic_exchange_explicit(volatile atomic_address*, void*, memory_order);
2063void* atomic_exchange_explicit(atomic_address*, void*, memory_order);
2064bool atomic_compare_exchange_weak(volatile atomic_address*, void**, void*);
2065bool atomic_compare_exchange_weak(atomic_address*, void**, void*);
2066bool atomic_compare_exchange_strong(volatile atomic_address*, void**, void*);
2067bool atomic_compare_exchange_strong(atomic_address*, void**, void*);
2068bool atomic_compare_exchange_weak_explicit(volatile atomic_address*, void**,
2069 void*, memory_order, memory_order);
2070bool atomic_compare_exchange_weak_explicit(atomic_address*, void**, void*,
2071 memory_order, memory_order);
2072bool atomic_compare_exchange_strong_explicit(volatile atomic_address*, void**,
2073 void*, memory_order, memory_order);
2074bool atomic_compare_exchange_strong_explicit(atomic_address*, void**, void*,
2075 memory_order, memory_order);
2076void* atomic_fetch_add(volatile atomic_address*, ptrdiff_t);
2077void* atomic_fetch_add(atomic_address*, ptrdiff_t);
2078void* atomic_fetch_add_explicit(volatile atomic_address*, ptrdiff_t,
2079 memory_order);
2080void* atomic_fetch_add_explicit(atomic_address*, ptrdiff_t, memory_order);
2081void* atomic_fetch_sub(volatile atomic_address*, ptrdiff_t);
2082void* atomic_fetch_sub(atomic_address*, ptrdiff_t);
2083void* atomic_fetch_sub_explicit(volatile atomic_address*, ptrdiff_t,
2084 memory_order);
2085void* atomic_fetch_sub_explicit(atomic_address*, ptrdiff_t, memory_order);
2086
2087// generic types
2088
2089template <class T>
2090struct atomic
2091{
2092 bool is_lock_free() const volatile;
2093 bool is_lock_free() const;
2094 void store(T, memory_order = memory_order_seq_cst) volatile;
2095 void store(T, memory_order = memory_order_seq_cst);
2096 T load(memory_order = memory_order_seq_cst) const volatile;
2097 T load(memory_order = memory_order_seq_cst) const;
2098 operator T() const volatile;
2099 operator T() const;
2100 T exchange(T, memory_order = memory_order_seq_cst) volatile;
2101 T exchange(T, memory_order = memory_order_seq_cst);
2102 bool compare_exchange_weak(T&, T, memory_order, memory_order) volatile;
2103 bool compare_exchange_weak(T&, T, memory_order, memory_order);
2104 bool compare_exchange_strong(T&, T, memory_order, memory_order) volatile;
2105 bool compare_exchange_strong(T&, T, memory_order, memory_order);
2106 bool compare_exchange_weak(T&, T,
2107 memory_order = memory_order_seq_cst) volatile;
2108 bool compare_exchange_weak(T&, T, memory_order = memory_order_seq_cst);
2109 bool compare_exchange_strong(T&, T,
2110 memory_order = memory_order_seq_cst) volatile;
2111 bool compare_exchange_strong(T&, T, memory_order = memory_order_seq_cst);
2112
2113 atomic() = default;
2114 constexpr atomic(T);
2115 atomic(const atomic&) = delete;
2116 atomic& operator=(const atomic&) = delete;
2117 atomic& operator=(const atomic&) volatile = delete;
2118 T operator=(T) volatile;
2119 T operator=(T);
2120};
2121
2122template <>
2123struct atomic<bool>
2124 : public atomic_bool
2125{
2126 atomic() = default;
2127 constexpr atomic(bool);
2128 atomic(const atomic&) = delete;
2129 atomic& operator=(const atomic&) = delete;
2130 atomic& operator=(const atomic&) volatile = delete;
2131 bool operator=(bool) volatile;
2132 bool operator=(bool);
2133 operator bool() const volatile;
2134 operator bool() const;
2135};
2136
2137template <>
2138struct atomic<char>
2139 : public atomic_char
2140{
2141 atomic() = default;
2142 constexpr atomic(char);
2143 atomic(const atomic&) = delete;
2144 atomic& operator=(const atomic&) = delete;
2145 atomic& operator=(const atomic&) volatile = delete;
2146 char operator=(char) volatile;
2147 char operator=(char);
2148 operator char() const volatile;
2149 operator char() const;
2150};
2151
2152template <>
2153struct atomic<signed char>
2154 : public atomic_schar
2155{
2156 atomic() = default;
2157 constexpr atomic(signed char);
2158 atomic(const atomic&) = delete;
2159 atomic& operator=(const atomic&) = delete;
2160 atomic& operator=(const atomic&) volatile = delete;
2161 signed char operator=(signed char) volatile;
2162 signed char operator=(signed char);
2163 operator signed char() const volatile;
2164 operator signed char() const;
2165};
2166
2167template <>
2168struct atomic<unsigned char>
2169 : public atomic_uchar
2170{
2171 atomic() = default;
2172 constexpr atomic(unsigned char);
2173 atomic(const atomic&) = delete;
2174 atomic& operator=(const atomic&) = delete;
2175 atomic& operator=(const atomic&) volatile = delete;
2176 unsigned char operator=(unsigned char) volatile;
2177 unsigned char operator=(unsigned char);
2178 operator unsigned char() const volatile;
2179 operator unsigned char() const;
2180};
2181
2182template <>
2183struct atomic<short>
2184 : public atomic_short
2185{
2186 atomic() = default;
2187 constexpr atomic(short);
2188 atomic(const atomic&) = delete;
2189 atomic& operator=(const atomic&) = delete;
2190 atomic& operator=(const atomic&) volatile = delete;
2191 short operator=(short) volatile;
2192 short operator=(short);
2193 operator short() const volatile;
2194 operator short() const;
2195};
2196
2197template <>
2198struct atomic<unsigned short>
2199 : public atomic_ushort
2200{
2201 atomic() = default;
2202 constexpr atomic(unsigned short);
2203 atomic(const atomic&) = delete;
2204 atomic& operator=(const atomic&) = delete;
2205 atomic& operator=(const atomic&) volatile = delete;
2206 unsigned short operator=(unsigned short) volatile;
2207 unsigned short operator=(unsigned short);
2208 operator unsigned short() const volatile;
2209 operator unsigned short() const;
2210};
2211
2212template <>
2213struct atomic<int>
2214 : public atomic_int
2215{
2216 atomic() = default;
2217 constexpr atomic(int);
2218 atomic(const atomic&) = delete;
2219 atomic& operator=(const atomic&) = delete;
2220 atomic& operator=(const atomic&) volatile = delete;
2221 int operator=(int) volatile;
2222 int operator=(int);
2223 operator int() const volatile;
2224 operator int() const;
2225};
2226
2227template <>
2228struct atomic<unsigned int>
2229 : public atomic_uint
2230{
2231 atomic() = default;
2232 constexpr atomic(unsigned int);
2233 atomic(const atomic&) = delete;
2234 atomic& operator=(const atomic&) = delete;
2235 atomic& operator=(const atomic&) volatile = delete;
2236 unsigned int operator=(unsigned int) volatile;
2237 unsigned int operator=(unsigned int);
2238 operator unsigned int() const volatile;
2239 operator unsigned int() const;
2240};
2241
2242template <>
2243struct atomic<long>
2244 : public atomic_long
2245{
2246 atomic() = default;
2247 constexpr atomic(long);
2248 atomic(const atomic&) = delete;
2249 atomic& operator=(const atomic&) = delete;
2250 atomic& operator=(const atomic&) volatile = delete;
2251 long operator=(long) volatile;
2252 long operator=(long);
2253 operator long() const volatile;
2254 operator long() const;
2255};
2256
2257template <>
2258struct atomic<unsigned long>
2259 : public atomic_ulong
2260{
2261 atomic() = default;
2262 constexpr atomic(unsigned long);
2263 atomic(const atomic&) = delete;
2264 atomic& operator=(const atomic&) = delete;
2265 atomic& operator=(const atomic&) volatile = delete;
2266 unsigned long operator=(unsigned long) volatile;
2267 unsigned long operator=(unsigned long);
2268 operator unsigned long() const volatile;
2269 operator unsigned long() const;
2270};
2271
2272template <>
2273struct atomic<long long>
2274 : public atomic_llong
2275{
2276 atomic() = default;
2277 constexpr atomic(long long);
2278 atomic(const atomic&) = delete;
2279 atomic& operator=(const atomic&) = delete;
2280 atomic& operator=(const atomic&) volatile = delete;
2281 long long operator=(long long) volatile;
2282 long long operator=(long long);
2283 operator long long() const volatile;
2284 operator long long() const;
2285};
2286
2287template <>
2288struct atomic<unsigned long long>
2289 : public atomic_ullong
2290{
2291 atomic() = default;
2292 constexpr atomic(unsigned long long);
2293 atomic(const atomic&) = delete;
2294 atomic& operator=(const atomic&) = delete;
2295 atomic& operator=(const atomic&) volatile = delete;
2296 unsigned long long operator=(unsigned long long) volatile;
2297 unsigned long long operator=(unsigned long long);
2298 operator unsigned long long() const volatile;
2299 operator unsigned long long() const;
2300};
2301
2302template <>
2303struct atomic<char16_t>
2304 : public atomic_char16_t
2305{
2306 atomic() = default;
2307 constexpr atomic(char16_t);
2308 atomic(const atomic&) = delete;
2309 atomic& operator=(const atomic&) = delete;
2310 atomic& operator=(const atomic&) volatile = delete;
2311 char16_t operator=(char16_t) volatile;
2312 char16_t operator=(char16_t);
2313 operator char16_t() const volatile;
2314 operator char16_t() const;
2315};
2316
2317template <>
2318struct atomic<char32_t>
2319 : public atomic_char32_t
2320{
2321 atomic() = default;
2322 constexpr atomic(char32_t);
2323 atomic(const atomic&) = delete;
2324 atomic& operator=(const atomic&) = delete;
2325 atomic& operator=(const atomic&) volatile = delete;
2326 char32_t operator=(char32_t) volatile;
2327 char32_t operator=(char32_t);
2328 operator char32_t() const volatile;
2329 operator char32_t() const;
2330};
2331
2332template <>
2333struct atomic<wchar_t>
2334 : public atomic_wchar_t
2335{
2336 atomic() = default;
2337 constexpr atomic(wchar_t);
2338 atomic(const atomic&) = delete;
2339 atomic& operator=(const atomic&) = delete;
2340 atomic& operator=(const atomic&) volatile = delete;
2341 wchar_t operator=(wchar_t) volatile;
2342 wchar_t operator=(wchar_t);
2343 operator wchar_t() const volatile;
2344 operator wchar_t() const;
2345};
2346
2347template <class T>
2348struct atomic<T*>
2349 : public atomic_address
2350{
2351 void store(T*, memory_order = memory_order_seq_cst) volatile;
2352 void store(T*, memory_order = memory_order_seq_cst);
2353 T* load(memory_order = memory_order_seq_cst) const volatile;
2354 T* load(memory_order = memory_order_seq_cst) const;
2355 operator T*() const volatile;
2356 operator T*() const;
2357 T* exchange(T*, memory_order = memory_order_seq_cst) volatile;
2358 T* exchange(T*, memory_order = memory_order_seq_cst);
2359 bool compare_exchange_weak(T*&, T*, memory_order, memory_order) volatile;
2360 bool compare_exchange_weak(T*&, T*, memory_order, memory_order);
2361 bool compare_exchange_strong(T*&, T*, memory_order, memory_order) volatile;
2362 bool compare_exchange_strong(T*&, T*, memory_order, memory_order);
2363 bool compare_exchange_weak(T*&, T*,
2364 memory_order = memory_order_seq_cst) volatile;
2365 bool compare_exchange_weak(T*&, T*, memory_order = memory_order_seq_cst);
2366 bool compare_exchange_strong(T*&, T*,
2367 memory_order = memory_order_seq_cst) volatile;
2368 bool compare_exchange_strong(T*&, T*, memory_order = memory_order_seq_cst);
2369 T* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
2370 T* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst);
2371 T* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
2372 T* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst);
2373 atomic() = default;
2374 constexpr atomic(T*);
2375 atomic(const atomic&) = delete;
2376 atomic& operator=(const atomic&) = delete;
2377 atomic& operator=(const atomic&) volatile = delete;
2378 T* operator=(T*) volatile;
2379 T* operator=(T*);
2380 T* operator++(int) volatile;
2381 T* operator++(int);
2382 T* operator--(int) volatile;
2383 T* operator--(int);
2384 T* operator++() volatile;
2385 T* operator++();
2386 T* operator--() volatile;
2387 T* operator--();
2388 T* operator+=(ptrdiff_t) volatile;
2389 T* operator+=(ptrdiff_t);
2390 T* operator-=(ptrdiff_t) volatile;
2391 T* operator-=(ptrdiff_t);
2392};
2393
2394// fences
2395
2396void atomic_thread_fence(memory_order);
2397void atomic_signal_fence(memory_order);
2398
2399} // std
2400
2401*/
2402
2403#include <__config>
2404
2405#pragma GCC system_header
2406
2407_LIBCPP_BEGIN_NAMESPACE_STD
2408
Howard Hinnantd1176e22010-09-28 17:13:38 +00002409typedef enum memory_order
2410{
2411 memory_order_relaxed, memory_order_consume, memory_order_acquire,
2412 memory_order_release, memory_order_acq_rel, memory_order_seq_cst
2413} memory_order;
2414
2415template <class _Tp>
2416inline _LIBCPP_INLINE_VISIBILITY
2417_Tp
2418kill_dependency(_Tp __y)
2419{
2420 return __y;
2421}
Howard Hinnant8f73c632010-09-27 21:17:38 +00002422
Howard Hinnanted760f42010-09-29 18:13:54 +00002423// flag type and operations
2424
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002425typedef bool __atomic_flag__;
Howard Hinnant6cac2c22010-10-05 14:02:23 +00002426
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002427struct atomic_flag;
Howard Hinnanted760f42010-09-29 18:13:54 +00002428
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002429bool atomic_flag_test_and_set(volatile atomic_flag*);
2430bool atomic_flag_test_and_set(atomic_flag*);
2431bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order);
2432bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order);
2433void atomic_flag_clear(volatile atomic_flag*);
2434void atomic_flag_clear(atomic_flag*);
2435void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order);
2436void atomic_flag_clear_explicit(atomic_flag*, memory_order);
2437
2438typedef struct _LIBCPP_VISIBLE atomic_flag
Howard Hinnanted760f42010-09-29 18:13:54 +00002439{
Howard Hinnant6cac2c22010-10-05 14:02:23 +00002440 __atomic_flag__ __flg_;
Howard Hinnanted760f42010-09-29 18:13:54 +00002441
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002442 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002443 bool test_and_set(memory_order __o = memory_order_seq_cst) volatile
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002444 {return atomic_flag_test_and_set_explicit(this, __o);}
2445 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002446 bool test_and_set(memory_order __o = memory_order_seq_cst)
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002447 {return atomic_flag_test_and_set_explicit(this, __o);}
Howard Hinnanted760f42010-09-29 18:13:54 +00002448
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002449 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002450 void clear(memory_order __o = memory_order_seq_cst) volatile
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002451 {atomic_flag_clear_explicit(this, __o);}
2452 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002453 void clear(memory_order __o = memory_order_seq_cst)
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002454 {atomic_flag_clear_explicit(this, __o);}
Howard Hinnanted760f42010-09-29 18:13:54 +00002455
2456#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
2457 atomic_flag() = default;
2458#else
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002459 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant79101ae2010-09-30 21:05:29 +00002460 atomic_flag() {};
Howard Hinnanted760f42010-09-29 18:13:54 +00002461#endif
2462
Howard Hinnanted760f42010-09-29 18:13:54 +00002463#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
2464 atomic_flag(const atomic_flag&) = delete;
2465 atomic_flag& operator=(const atomic_flag&) = delete;
2466 atomic_flag& operator=(const atomic_flag&) volatile = delete;
2467#else
2468private:
2469 atomic_flag(const atomic_flag&);
2470 atomic_flag& operator=(const atomic_flag&);
2471 atomic_flag& operator=(const atomic_flag&) volatile;
2472public:
2473#endif
Howard Hinnanted760f42010-09-29 18:13:54 +00002474} atomic_flag;
2475
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002476inline _LIBCPP_INLINE_VISIBILITY
2477bool
2478atomic_flag_test_and_set(volatile atomic_flag* __f)
2479{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002480 return __atomic_exchange(&__f->__flg_, __atomic_flag__(true),
2481 memory_order_seq_cst)
Howard Hinnant6cac2c22010-10-05 14:02:23 +00002482 == __atomic_flag__(true);
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002483}
Howard Hinnanted760f42010-09-29 18:13:54 +00002484
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002485inline _LIBCPP_INLINE_VISIBILITY
2486bool
2487atomic_flag_test_and_set(atomic_flag* __f)
2488{
2489 return atomic_flag_test_and_set(const_cast<volatile atomic_flag*>(__f));
2490}
2491
2492inline _LIBCPP_INLINE_VISIBILITY
2493bool
2494atomic_flag_test_and_set_explicit(volatile atomic_flag* __f, memory_order __o)
2495{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002496 return __atomic_exchange(&__f->__flg_, __atomic_flag__(true), __o)
Howard Hinnant6cac2c22010-10-05 14:02:23 +00002497 == __atomic_flag__(true);
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002498}
2499
2500inline _LIBCPP_INLINE_VISIBILITY
2501bool
2502atomic_flag_test_and_set_explicit(atomic_flag* __f, memory_order __o)
2503{
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002504 return atomic_flag_test_and_set_explicit(const_cast<volatile atomic_flag*>
2505 (__f), __o);
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002506}
2507
2508inline _LIBCPP_INLINE_VISIBILITY
2509void
2510atomic_flag_clear(volatile atomic_flag* __f)
2511{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002512 __atomic_store(&__f->__flg_, __atomic_flag__(false), memory_order_seq_cst);
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002513}
2514
2515inline _LIBCPP_INLINE_VISIBILITY
2516void
2517atomic_flag_clear(atomic_flag* __f)
2518{
2519 atomic_flag_clear(const_cast<volatile atomic_flag*>(__f));
2520}
2521
2522inline _LIBCPP_INLINE_VISIBILITY
2523void
2524atomic_flag_clear_explicit(volatile atomic_flag* __f, memory_order __o)
2525{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002526 __atomic_store(&__f->__flg_, __atomic_flag__(false), __o);
Howard Hinnant767ae2b2010-09-29 21:20:03 +00002527}
2528
2529inline _LIBCPP_INLINE_VISIBILITY
2530void
2531atomic_flag_clear_explicit(atomic_flag* __f, memory_order __o)
2532{
2533 atomic_flag_clear_explicit(const_cast<volatile atomic_flag*>(__f), __o);
2534}
2535
2536#define ATOMIC_FLAG_INIT {false}
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002537#define ATOMIC_VAR_INIT(__v) {__v}
2538
2539inline _LIBCPP_INLINE_VISIBILITY
2540memory_order
2541__translate_memory_order(memory_order __o)
2542{
2543 switch (__o)
2544 {
2545 case memory_order_acq_rel:
2546 return memory_order_acquire;
2547 case memory_order_release:
2548 return memory_order_relaxed;
2549 }
2550 return __o;
2551}
2552
2553// atomic_bool
2554
2555struct atomic_bool;
2556
2557bool atomic_is_lock_free(const volatile atomic_bool*);
2558bool atomic_is_lock_free(const atomic_bool*);
2559void atomic_init(volatile atomic_bool*, bool);
2560void atomic_init(atomic_bool*, bool);
2561void atomic_store(volatile atomic_bool*, bool);
2562void atomic_store(atomic_bool*, bool);
2563void atomic_store_explicit(volatile atomic_bool*, bool, memory_order);
2564void atomic_store_explicit(atomic_bool*, bool, memory_order);
2565bool atomic_load(const volatile atomic_bool*);
2566bool atomic_load(const atomic_bool*);
2567bool atomic_load_explicit(const volatile atomic_bool*, memory_order);
2568bool atomic_load_explicit(const atomic_bool*, memory_order);
2569bool atomic_exchange(volatile atomic_bool*, bool);
2570bool atomic_exchange(atomic_bool*, bool);
2571bool atomic_exchange_explicit(volatile atomic_bool*, bool, memory_order);
2572bool atomic_exchange_explicit(atomic_bool*, bool, memory_order);
2573bool atomic_compare_exchange_weak(volatile atomic_bool*, bool*, bool);
2574bool atomic_compare_exchange_weak(atomic_bool*, bool*, bool);
2575bool atomic_compare_exchange_strong(volatile atomic_bool*, bool*, bool);
2576bool atomic_compare_exchange_strong(atomic_bool*, bool*, bool);
2577bool atomic_compare_exchange_weak_explicit(volatile atomic_bool*, bool*, bool,
2578 memory_order, memory_order);
2579bool atomic_compare_exchange_weak_explicit(atomic_bool*, bool*, bool,
2580 memory_order, memory_order);
2581bool atomic_compare_exchange_strong_explicit(volatile atomic_bool*, bool*, bool,
2582 memory_order, memory_order);
2583bool atomic_compare_exchange_strong_explicit(atomic_bool*, bool*, bool,
2584 memory_order, memory_order);
2585
2586typedef struct atomic_bool
2587{
2588 bool __v_;
2589
2590 _LIBCPP_INLINE_VISIBILITY
2591 bool is_lock_free() const volatile
2592 {return atomic_is_lock_free(this);}
2593 _LIBCPP_INLINE_VISIBILITY
2594 bool is_lock_free() const
2595 {return atomic_is_lock_free(this);}
2596 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002597 void store(bool __v, memory_order __o = memory_order_seq_cst) volatile
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002598 {atomic_store_explicit(this, __v, __o);}
2599 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002600 void store(bool __v, memory_order __o = memory_order_seq_cst)
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002601 {atomic_store_explicit(this, __v, __o);}
2602 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002603 bool load(memory_order __o = memory_order_seq_cst) const volatile
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002604 {return atomic_load_explicit(this, __o);}
2605 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002606 bool load(memory_order __o = memory_order_seq_cst) const
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002607 {return atomic_load_explicit(this, __o);}
2608 _LIBCPP_INLINE_VISIBILITY
2609 operator bool() const volatile
2610 {return load();}
2611 _LIBCPP_INLINE_VISIBILITY
2612 operator bool() const
2613 {return load();}
2614 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002615 bool exchange(bool __v, memory_order __o = memory_order_seq_cst) volatile
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002616 {return atomic_exchange_explicit(this, __v, __o);}
2617 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002618 bool exchange(bool __v, memory_order __o = memory_order_seq_cst)
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002619 {return atomic_exchange_explicit(this, __v, __o);}
2620 _LIBCPP_INLINE_VISIBILITY
2621 bool compare_exchange_weak(bool& __v, bool __e, memory_order __s,
2622 memory_order __f) volatile
2623 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
2624 __f);}
2625 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002626 bool compare_exchange_weak(bool& __v, bool __e,
2627 memory_order __s = memory_order_seq_cst) volatile
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002628 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002629 __translate_memory_order(__s));}
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002630 _LIBCPP_INLINE_VISIBILITY
2631 bool compare_exchange_weak(bool& __v, bool __e, memory_order __s,
2632 memory_order __f)
2633 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
2634 __f);}
2635 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002636 bool compare_exchange_weak(bool& __v, bool __e,
2637 memory_order __s = memory_order_seq_cst)
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002638 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002639 __translate_memory_order(__s));}
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002640 _LIBCPP_INLINE_VISIBILITY
2641 bool compare_exchange_strong(bool& __v, bool __e, memory_order __s,
2642 memory_order __f) volatile
2643 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
2644 __f);}
2645 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002646 bool compare_exchange_strong(bool& __v, bool __e,
2647 memory_order __s = memory_order_seq_cst) volatile
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002648 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002649 __translate_memory_order(__s));}
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002650 _LIBCPP_INLINE_VISIBILITY
2651 bool compare_exchange_strong(bool& __v, bool __e, memory_order __s,
2652 memory_order __f)
2653 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
2654 __f);}
2655 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002656 bool compare_exchange_strong(bool& __v, bool __e,
2657 memory_order __s = memory_order_seq_cst)
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002658 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002659 __translate_memory_order(__s));}
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002660#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
2661 atomic_bool() = default;
2662#else
2663 _LIBCPP_INLINE_VISIBILITY
2664 atomic_bool() {}
2665#endif
2666 _LIBCPP_INLINE_VISIBILITY
2667 /*constexpr*/ atomic_bool(bool __v)
2668 : __v_(__v) {}
2669#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
2670 atomic_bool(const atomic_bool&) = delete;
2671 atomic_bool& operator=(const atomic_bool&) = delete;
2672 atomic_bool& operator=(const atomic_bool&) volatile = delete;
2673#else
2674private:
2675 atomic_bool(const atomic_bool&);
2676 atomic_bool& operator=(const atomic_bool&);
2677 atomic_bool& operator=(const atomic_bool&) volatile;
2678public:
2679#endif
2680 _LIBCPP_INLINE_VISIBILITY
2681 bool operator=(bool __v) volatile
2682 {store(__v); return __v;}
Howard Hinnante7385012010-10-19 16:51:18 +00002683 _LIBCPP_INLINE_VISIBILITY
2684 bool operator=(bool __v)
2685 {store(__v); return __v;}
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002686} atomic_bool;
2687
2688inline _LIBCPP_INLINE_VISIBILITY
2689bool atomic_is_lock_free(const volatile atomic_bool*)
2690{
Howard Hinnante7385012010-10-19 16:51:18 +00002691 typedef bool type;
2692 return __atomic_is_lock_free(type);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002693}
2694
2695inline _LIBCPP_INLINE_VISIBILITY
2696bool atomic_is_lock_free(const atomic_bool* __obj)
2697{
2698 return atomic_is_lock_free(const_cast<const volatile atomic_bool*>(__obj));
2699}
2700
2701inline _LIBCPP_INLINE_VISIBILITY
2702void atomic_init(volatile atomic_bool* __obj, bool __desr)
2703{
2704 __obj->__v_ = __desr;
2705}
2706
2707inline _LIBCPP_INLINE_VISIBILITY
2708void atomic_init(atomic_bool* __obj, bool __desr)
2709{
2710 __obj->__v_ = __desr;
2711}
2712
2713inline _LIBCPP_INLINE_VISIBILITY
2714void atomic_store(volatile atomic_bool* __obj, bool __desr)
2715{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002716 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002717}
2718
2719inline _LIBCPP_INLINE_VISIBILITY
2720void atomic_store(atomic_bool* __obj, bool __desr)
2721{
2722 atomic_store(const_cast<volatile atomic_bool*>(__obj), __desr);
2723}
2724
2725inline _LIBCPP_INLINE_VISIBILITY
2726void atomic_store_explicit(volatile atomic_bool* __obj, bool __desr,
2727 memory_order __o)
2728{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002729 __atomic_store(&__obj->__v_, __desr, __o);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002730}
2731
2732inline _LIBCPP_INLINE_VISIBILITY
2733void atomic_store_explicit(atomic_bool* __obj, bool __desr, memory_order __o)
2734{
2735 atomic_store_explicit(const_cast<volatile atomic_bool*>(__obj), __desr,
2736 __o);
2737}
2738
2739inline _LIBCPP_INLINE_VISIBILITY
2740bool atomic_load(const volatile atomic_bool* __obj)
2741{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002742 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002743}
2744
2745inline _LIBCPP_INLINE_VISIBILITY
2746bool atomic_load(const atomic_bool* __obj)
2747{
2748 return atomic_load(const_cast<const volatile atomic_bool*>(__obj));
2749}
2750
2751inline _LIBCPP_INLINE_VISIBILITY
2752bool atomic_load_explicit(const volatile atomic_bool* __obj, memory_order __o)
2753{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002754 return __atomic_load(&__obj->__v_, __o);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002755}
2756
2757inline _LIBCPP_INLINE_VISIBILITY
2758bool atomic_load_explicit(const atomic_bool* __obj, memory_order __o)
2759{
2760 return atomic_load_explicit(const_cast<const volatile atomic_bool*>
2761 (__obj), __o);
2762}
2763
2764inline _LIBCPP_INLINE_VISIBILITY
2765bool atomic_exchange(volatile atomic_bool* __obj, bool __desr)
2766{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002767 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002768}
2769
2770inline _LIBCPP_INLINE_VISIBILITY
2771bool atomic_exchange(atomic_bool* __obj, bool __desr)
2772{
2773 return atomic_exchange(const_cast<volatile atomic_bool*>(__obj), __desr);
2774}
2775
2776inline _LIBCPP_INLINE_VISIBILITY
2777bool atomic_exchange_explicit(volatile atomic_bool* __obj, bool __desr,
2778 memory_order __o)
2779{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002780 return __atomic_exchange(&__obj->__v_, __desr, __o);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002781}
2782
2783inline _LIBCPP_INLINE_VISIBILITY
2784bool atomic_exchange_explicit(atomic_bool* __obj, bool __desr, memory_order __o)
2785{
2786 return atomic_exchange_explicit(const_cast<volatile atomic_bool*>
2787 (__obj), __desr, __o);
2788}
2789
2790inline _LIBCPP_INLINE_VISIBILITY
2791bool atomic_compare_exchange_weak(volatile atomic_bool* __obj, bool* __exp,
2792 bool __desr)
2793{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002794 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
2795 memory_order_seq_cst, memory_order_seq_cst);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002796}
2797
2798inline _LIBCPP_INLINE_VISIBILITY
2799bool atomic_compare_exchange_weak(atomic_bool* __obj, bool* __exp, bool __desr)
2800{
2801 return atomic_compare_exchange_weak(const_cast<volatile atomic_bool*>
2802 (__obj), __exp, __desr);
2803}
2804
2805inline _LIBCPP_INLINE_VISIBILITY
2806bool atomic_compare_exchange_weak_explicit(volatile atomic_bool* __obj,
2807 bool* __exp, bool __desr,
2808 memory_order __s, memory_order __f)
2809{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002810 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
2811 __f);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002812}
2813
2814inline _LIBCPP_INLINE_VISIBILITY
2815bool atomic_compare_exchange_weak_explicit(atomic_bool* __obj, bool* __exp,
2816 bool __desr,
2817 memory_order __s, memory_order __f)
2818{
2819 return atomic_compare_exchange_weak_explicit(
2820 const_cast<volatile atomic_bool*>(__obj), __exp, __desr, __s, __f);
2821}
2822
2823inline _LIBCPP_INLINE_VISIBILITY
2824bool atomic_compare_exchange_strong(volatile atomic_bool* __obj, bool* __exp,
2825 bool __desr)
2826{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002827 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
2828 memory_order_seq_cst, memory_order_seq_cst);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002829}
2830
2831inline _LIBCPP_INLINE_VISIBILITY
2832bool atomic_compare_exchange_strong(atomic_bool* __obj, bool* __exp,
2833 bool __desr)
2834{
2835 return atomic_compare_exchange_strong(const_cast<volatile atomic_bool*>
2836 (__obj), __exp, __desr);
2837}
2838
2839inline _LIBCPP_INLINE_VISIBILITY
2840bool atomic_compare_exchange_strong_explicit(volatile atomic_bool* __obj,
2841 bool* __exp, bool __desr,
2842 memory_order __s, memory_order __f)
2843{
Howard Hinnant21ef47f2010-10-18 20:39:07 +00002844 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
2845 __f);
Howard Hinnant611fdaf2010-10-04 18:52:54 +00002846}
2847
2848inline _LIBCPP_INLINE_VISIBILITY
2849bool atomic_compare_exchange_strong_explicit(atomic_bool* __obj, bool* __exp,
2850 bool __desr,
2851 memory_order __s, memory_order __f)
2852{
2853 return atomic_compare_exchange_strong_explicit(
2854 const_cast<volatile atomic_bool*>(__obj), __exp, __desr, __s, __f);
2855}
Howard Hinnanted760f42010-09-29 18:13:54 +00002856
Howard Hinnante7385012010-10-19 16:51:18 +00002857// atomic_char
2858
2859struct atomic_char;
2860
2861bool atomic_is_lock_free(const volatile atomic_char*);
2862bool atomic_is_lock_free(const atomic_char*);
2863void atomic_init(volatile atomic_char*, char);
2864void atomic_init(atomic_char*, char);
2865void atomic_store(volatile atomic_char*, char);
2866void atomic_store(atomic_char*, char);
2867void atomic_store_explicit(volatile atomic_char*, char, memory_order);
2868void atomic_store_explicit(atomic_char*, char, memory_order);
2869char atomic_load(const volatile atomic_char*);
2870char atomic_load(const atomic_char*);
2871char atomic_load_explicit(const volatile atomic_char*, memory_order);
2872char atomic_load_explicit(const atomic_char*, memory_order);
2873char atomic_exchange(volatile atomic_char*, char);
2874char atomic_exchange(atomic_char*, char);
2875char atomic_exchange_explicit(volatile atomic_char*, char, memory_order);
2876char atomic_exchange_explicit(atomic_char*, char, memory_order);
2877bool atomic_compare_exchange_weak(volatile atomic_char*, char*, char);
2878bool atomic_compare_exchange_weak(atomic_char*, char*, char);
2879bool atomic_compare_exchange_strong(volatile atomic_char*, char*, char);
2880bool atomic_compare_exchange_strong(atomic_char*, char*, char);
2881bool atomic_compare_exchange_weak_explicit(volatile atomic_char*, char*, char,
2882 memory_order, memory_order);
2883bool atomic_compare_exchange_weak_explicit(atomic_char*, char*, char,
2884 memory_order, memory_order);
2885bool atomic_compare_exchange_strong_explicit(volatile atomic_char*, char*, char,
2886 memory_order, memory_order);
2887bool atomic_compare_exchange_strong_explicit(atomic_char*, char*, char,
2888 memory_order, memory_order);
2889char atomic_fetch_add(volatile atomic_char*, char);
2890char atomic_fetch_add(atomic_char*, char);
2891char atomic_fetch_add_explicit(volatile atomic_char*, char, memory_order);
2892char atomic_fetch_add_explicit(atomic_char*, char, memory_order);
2893char atomic_fetch_sub(volatile atomic_char*, char);
2894char atomic_fetch_sub(atomic_char*, char);
2895char atomic_fetch_sub_explicit(volatile atomic_char*, char, memory_order);
2896char atomic_fetch_sub_explicit(atomic_char*, char, memory_order);
2897char atomic_fetch_and(volatile atomic_char*, char);
2898char atomic_fetch_and(atomic_char*, char);
2899char atomic_fetch_and_explicit(volatile atomic_char*, char, memory_order);
2900char atomic_fetch_and_explicit(atomic_char*, char, memory_order);
2901char atomic_fetch_or(volatile atomic_char*, char);
2902char atomic_fetch_or(atomic_char*, char);
2903char atomic_fetch_or_explicit(volatile atomic_char*, char, memory_order);
2904char atomic_fetch_or_explicit(atomic_char*, char, memory_order);
2905char atomic_fetch_xor(volatile atomic_char*, char);
2906char atomic_fetch_xor(atomic_char*, char);
2907char atomic_fetch_xor_explicit(volatile atomic_char*, char, memory_order);
2908char atomic_fetch_xor_explicit(atomic_char*, char, memory_order);
2909
2910typedef struct atomic_char
2911{
2912 char __v_;
2913
2914 _LIBCPP_INLINE_VISIBILITY
2915 bool is_lock_free() const volatile
2916 {return atomic_is_lock_free(this);}
2917 _LIBCPP_INLINE_VISIBILITY
2918 bool is_lock_free() const
2919 {return atomic_is_lock_free(this);}
2920 _LIBCPP_INLINE_VISIBILITY
2921 void store(char __v, memory_order __o = memory_order_seq_cst) volatile
2922 {atomic_store_explicit(this, __v, __o);}
2923 _LIBCPP_INLINE_VISIBILITY
2924 void store(char __v, memory_order __o = memory_order_seq_cst)
2925 {atomic_store_explicit(this, __v, __o);}
2926 _LIBCPP_INLINE_VISIBILITY
2927 char load(memory_order __o = memory_order_seq_cst) const volatile
2928 {return atomic_load_explicit(this, __o);}
2929 _LIBCPP_INLINE_VISIBILITY
2930 char load(memory_order __o = memory_order_seq_cst) const
2931 {return atomic_load_explicit(this, __o);}
2932 _LIBCPP_INLINE_VISIBILITY
2933 operator char() const volatile
2934 {return load();}
2935 _LIBCPP_INLINE_VISIBILITY
2936 operator char() const
2937 {return load();}
2938 _LIBCPP_INLINE_VISIBILITY
2939 char exchange(char __v, memory_order __o = memory_order_seq_cst) volatile
2940 {return atomic_exchange_explicit(this, __v, __o);}
2941 _LIBCPP_INLINE_VISIBILITY
2942 char exchange(char __v, memory_order __o = memory_order_seq_cst)
2943 {return atomic_exchange_explicit(this, __v, __o);}
2944 _LIBCPP_INLINE_VISIBILITY
2945 bool compare_exchange_weak(char& __v, char __e, memory_order __s,
2946 memory_order __f) volatile
2947 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
2948 __f);}
2949 _LIBCPP_INLINE_VISIBILITY
2950 bool compare_exchange_weak(char& __v, char __e, memory_order __s,
2951 memory_order __f)
2952 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
2953 __f);}
2954 _LIBCPP_INLINE_VISIBILITY
2955 bool compare_exchange_strong(char& __v, char __e, memory_order __s,
2956 memory_order __f) volatile
2957 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
2958 __f);}
2959 _LIBCPP_INLINE_VISIBILITY
2960 bool compare_exchange_strong(char& __v, char __e, memory_order __s,
2961 memory_order __f)
2962 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
2963 __f);}
2964 _LIBCPP_INLINE_VISIBILITY
2965 bool compare_exchange_weak(char& __v, char __e,
2966 memory_order __s = memory_order_seq_cst) volatile
2967 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
2968 __translate_memory_order(__s));}
2969 _LIBCPP_INLINE_VISIBILITY
2970 bool compare_exchange_weak(char& __v, char __e,
2971 memory_order __s = memory_order_seq_cst)
2972 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
2973 __translate_memory_order(__s));}
2974 _LIBCPP_INLINE_VISIBILITY
2975 bool compare_exchange_strong(char& __v, char __e,
2976 memory_order __s = memory_order_seq_cst) volatile
2977 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
2978 __translate_memory_order(__s));}
2979 _LIBCPP_INLINE_VISIBILITY
2980 bool compare_exchange_strong(char& __v, char __e,
2981 memory_order __s = memory_order_seq_cst)
2982 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
2983 __translate_memory_order(__s));}
2984 _LIBCPP_INLINE_VISIBILITY
2985 char fetch_add(char __v, memory_order __o = memory_order_seq_cst) volatile
2986 {return atomic_fetch_add_explicit(this, __v, __o);}
2987 _LIBCPP_INLINE_VISIBILITY
2988 char fetch_add(char __v, memory_order __o = memory_order_seq_cst)
2989 {return atomic_fetch_add_explicit(this, __v, __o);}
2990 _LIBCPP_INLINE_VISIBILITY
2991 char fetch_sub(char __v, memory_order __o = memory_order_seq_cst) volatile
2992 {return atomic_fetch_sub_explicit(this, __v, __o);}
2993 _LIBCPP_INLINE_VISIBILITY
2994 char fetch_sub(char __v, memory_order __o = memory_order_seq_cst)
2995 {return atomic_fetch_sub_explicit(this, __v, __o);}
2996 _LIBCPP_INLINE_VISIBILITY
2997 char fetch_and(char __v, memory_order __o = memory_order_seq_cst) volatile
2998 {return atomic_fetch_and_explicit(this, __v, __o);}
2999 _LIBCPP_INLINE_VISIBILITY
3000 char fetch_and(char __v, memory_order __o = memory_order_seq_cst)
3001 {return atomic_fetch_and_explicit(this, __v, __o);}
3002 _LIBCPP_INLINE_VISIBILITY
3003 char fetch_or(char __v, memory_order __o = memory_order_seq_cst) volatile
3004 {return atomic_fetch_or_explicit(this, __v, __o);}
3005 _LIBCPP_INLINE_VISIBILITY
3006 char fetch_or(char __v, memory_order __o = memory_order_seq_cst)
3007 {return atomic_fetch_or_explicit(this, __v, __o);}
3008 _LIBCPP_INLINE_VISIBILITY
3009 char fetch_xor(char __v, memory_order __o = memory_order_seq_cst) volatile
3010 {return atomic_fetch_xor_explicit(this, __v, __o);}
3011 _LIBCPP_INLINE_VISIBILITY
3012 char fetch_xor(char __v, memory_order __o = memory_order_seq_cst)
3013 {return atomic_fetch_xor_explicit(this, __v, __o);}
3014#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
3015 atomic_char() = default;
3016#else
3017 _LIBCPP_INLINE_VISIBILITY
3018 atomic_char() {}
3019#endif
3020 _LIBCPP_INLINE_VISIBILITY
3021 /*constexpr*/ atomic_char(char __v)
3022 : __v_(__v) {}
3023#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
3024 atomic_char(const atomic_char&) = delete;
3025 atomic_char& operator=(const atomic_char&) = delete;
3026 atomic_char& operator=(const atomic_char&) volatile = delete;
3027#else
3028private:
3029 atomic_char(const atomic_char&);
3030 atomic_char& operator=(const atomic_char&);
3031 atomic_char& operator=(const atomic_char&) volatile;
3032public:
3033#endif
3034 _LIBCPP_INLINE_VISIBILITY
3035 char operator=(char __v) volatile
3036 {store(__v); return __v;}
3037 _LIBCPP_INLINE_VISIBILITY
3038 char operator=(char __v)
3039 {store(__v); return __v;}
3040 _LIBCPP_INLINE_VISIBILITY
3041 char operator++(int) volatile
3042 {return fetch_add(char(1));}
3043 _LIBCPP_INLINE_VISIBILITY
3044 char operator++(int)
3045 {return fetch_add(char(1));}
3046 _LIBCPP_INLINE_VISIBILITY
3047 char operator--(int) volatile
3048 {return fetch_sub(char(1));}
3049 _LIBCPP_INLINE_VISIBILITY
3050 char operator--(int)
3051 {return fetch_sub(char(1));}
3052 _LIBCPP_INLINE_VISIBILITY
3053 char operator++() volatile
3054 {return char(fetch_add(char(1)) + 1);}
3055 _LIBCPP_INLINE_VISIBILITY
3056 char operator++()
3057 {return char(fetch_add(char(1)) + 1);}
3058 _LIBCPP_INLINE_VISIBILITY
3059 char operator--() volatile
3060 {return char(fetch_sub(char(1)) - 1);}
3061 _LIBCPP_INLINE_VISIBILITY
3062 char operator--()
3063 {return char(fetch_sub(char(1)) - 1);}
3064 _LIBCPP_INLINE_VISIBILITY
3065 char operator+=(char __v) volatile
3066 {return char(fetch_add(__v) + __v);}
3067 _LIBCPP_INLINE_VISIBILITY
3068 char operator+=(char __v)
3069 {return char(fetch_add(__v) + __v);}
3070 _LIBCPP_INLINE_VISIBILITY
3071 char operator-=(char __v) volatile
3072 {return char(fetch_sub(__v) - __v);}
3073 _LIBCPP_INLINE_VISIBILITY
3074 char operator-=(char __v)
3075 {return char(fetch_sub(__v) - __v);}
3076 _LIBCPP_INLINE_VISIBILITY
3077 char operator&=(char __v) volatile
3078 {return char(fetch_and(__v) & __v);}
3079 _LIBCPP_INLINE_VISIBILITY
3080 char operator&=(char __v)
3081 {return char(fetch_and(__v) & __v);}
3082 _LIBCPP_INLINE_VISIBILITY
3083 char operator|=(char __v) volatile
3084 {return char(fetch_or(__v) | __v);}
3085 _LIBCPP_INLINE_VISIBILITY
3086 char operator|=(char __v)
3087 {return char(fetch_or(__v) | __v);}
3088 _LIBCPP_INLINE_VISIBILITY
3089 char operator^=(char __v) volatile
3090 {return char(fetch_xor(__v) ^ __v);}
3091 _LIBCPP_INLINE_VISIBILITY
3092 char operator^=(char __v)
3093 {return char(fetch_xor(__v) ^ __v);}
3094} atomic_char;
3095
3096inline _LIBCPP_INLINE_VISIBILITY
3097bool
3098atomic_is_lock_free(const volatile atomic_char*)
3099{
3100 typedef char type;
3101 return __atomic_is_lock_free(type);
3102}
3103
3104inline _LIBCPP_INLINE_VISIBILITY
3105bool
3106atomic_is_lock_free(const atomic_char* __obj)
3107{
3108 return atomic_is_lock_free(const_cast<volatile atomic_char*>(__obj));
3109}
3110
3111inline _LIBCPP_INLINE_VISIBILITY
3112void
3113atomic_init(volatile atomic_char* __obj, char __desr)
3114{
3115 __obj->__v_ = __desr;
3116}
3117
3118inline _LIBCPP_INLINE_VISIBILITY
3119void
3120atomic_init(atomic_char* __obj, char __desr)
3121{
3122 __obj->__v_ = __desr;
3123}
3124
3125inline _LIBCPP_INLINE_VISIBILITY
3126void
3127atomic_store(volatile atomic_char* __obj, char __desr)
3128{
3129 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
3130}
3131
3132inline _LIBCPP_INLINE_VISIBILITY
3133void
3134atomic_store(atomic_char* __obj, char __desr)
3135{
3136 atomic_store(const_cast<volatile atomic_char*>(__obj), __desr);
3137}
3138
3139inline _LIBCPP_INLINE_VISIBILITY
3140void
3141atomic_store_explicit(volatile atomic_char* __obj, char __desr,
3142 memory_order __o)
3143{
3144 __atomic_store(&__obj->__v_, __desr, __o);
3145}
3146
3147inline _LIBCPP_INLINE_VISIBILITY
3148void
3149atomic_store_explicit(atomic_char* __obj, char __desr, memory_order __o)
3150{
3151 atomic_store_explicit(const_cast<volatile atomic_char*>(__obj), __desr,
3152 __o);
3153}
3154
3155inline _LIBCPP_INLINE_VISIBILITY
3156char
3157atomic_load(const volatile atomic_char* __obj)
3158{
3159 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
3160}
3161
3162inline _LIBCPP_INLINE_VISIBILITY
3163char
3164atomic_load(const atomic_char* __obj)
3165{
3166 return atomic_load(const_cast<const volatile atomic_char*>(__obj));
3167}
3168
3169inline _LIBCPP_INLINE_VISIBILITY
3170char
3171atomic_load_explicit(const volatile atomic_char* __obj, memory_order __o)
3172{
3173 return __atomic_load(&__obj->__v_, __o);
3174}
3175
3176inline _LIBCPP_INLINE_VISIBILITY
3177char
3178atomic_load_explicit(const atomic_char* __obj, memory_order __o)
3179{
3180 return atomic_load_explicit(const_cast<const volatile atomic_char*>
3181 (__obj), __o);
3182}
3183
3184inline _LIBCPP_INLINE_VISIBILITY
3185char
3186atomic_exchange(volatile atomic_char* __obj, char __desr)
3187{
3188 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
3189}
3190
3191inline _LIBCPP_INLINE_VISIBILITY
3192char
3193atomic_exchange(atomic_char* __obj, char __desr)
3194{
3195 return atomic_exchange(const_cast<volatile atomic_char*>(__obj), __desr);
3196}
3197
3198inline _LIBCPP_INLINE_VISIBILITY
3199char
3200atomic_exchange_explicit(volatile atomic_char* __obj, char __desr,
3201 memory_order __o)
3202{
3203 return __atomic_exchange(&__obj->__v_, __desr, __o);
3204}
3205
3206inline _LIBCPP_INLINE_VISIBILITY
3207char
3208atomic_exchange_explicit(atomic_char* __obj, char __desr, memory_order __o)
3209{
3210 return atomic_exchange_explicit(const_cast<volatile atomic_char*>
3211 (__obj), __desr, __o);
3212}
3213
3214inline _LIBCPP_INLINE_VISIBILITY
3215bool
3216atomic_compare_exchange_weak(volatile atomic_char* __obj, char* __exp,
3217 char __desr)
3218{
3219 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
3220 memory_order_seq_cst, memory_order_seq_cst);
3221}
3222
3223inline _LIBCPP_INLINE_VISIBILITY
3224bool
3225atomic_compare_exchange_weak(atomic_char* __obj, char* __exp, char __desr)
3226{
3227 return atomic_compare_exchange_weak(const_cast<volatile atomic_char*>
3228 (__obj), __exp, __desr);
3229}
3230
3231inline _LIBCPP_INLINE_VISIBILITY
3232bool
3233atomic_compare_exchange_strong(volatile atomic_char* __obj, char* __exp,
3234 char __desr)
3235{
3236 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
3237 memory_order_seq_cst, memory_order_seq_cst);
3238}
3239
3240inline _LIBCPP_INLINE_VISIBILITY
3241bool
3242atomic_compare_exchange_strong(atomic_char* __obj, char* __exp, char __desr)
3243{
3244 return atomic_compare_exchange_strong(const_cast<volatile atomic_char*>
3245 (__obj), __exp, __desr);
3246}
3247
3248inline _LIBCPP_INLINE_VISIBILITY
3249bool
3250atomic_compare_exchange_weak_explicit(volatile atomic_char* __obj, char* __exp,
3251 char __desr, memory_order __s,
3252 memory_order __f)
3253{
3254 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
3255 __f);
3256}
3257
3258inline _LIBCPP_INLINE_VISIBILITY
3259bool
3260atomic_compare_exchange_weak_explicit(atomic_char* __obj, char* __exp,
3261 char __desr, memory_order __s,
3262 memory_order __f)
3263{
3264 return atomic_compare_exchange_weak_explicit(
3265 const_cast<volatile atomic_char*>(__obj), __exp, __desr, __s, __f);
3266}
3267
3268inline _LIBCPP_INLINE_VISIBILITY
3269bool
3270atomic_compare_exchange_strong_explicit(volatile atomic_char* __obj,
3271 char* __exp, char __desr,
3272 memory_order __s, memory_order __f)
3273{
3274 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
3275 __f);
3276}
3277
3278inline _LIBCPP_INLINE_VISIBILITY
3279bool
3280atomic_compare_exchange_strong_explicit(atomic_char* __obj, char* __exp,
3281 char __desr, memory_order __s,
3282 memory_order __f)
3283{
3284 return atomic_compare_exchange_strong_explicit(
3285 const_cast<volatile atomic_char*>(__obj), __exp, __desr, __s, __f);
3286}
3287
3288inline _LIBCPP_INLINE_VISIBILITY
3289char
3290atomic_fetch_add(volatile atomic_char* __obj, char __v)
3291{
3292 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
3293}
3294
3295inline _LIBCPP_INLINE_VISIBILITY
3296char
3297atomic_fetch_add(atomic_char* __obj, char __v)
3298{
3299 return atomic_fetch_add(const_cast<volatile atomic_char*>(__obj), __v);
3300}
3301
3302inline _LIBCPP_INLINE_VISIBILITY
3303char
3304atomic_fetch_add_explicit(volatile atomic_char* __obj, char __v,
3305 memory_order __o)
3306{
3307 return __atomic_fetch_add(&__obj->__v_, __v, __o);
3308}
3309
3310inline _LIBCPP_INLINE_VISIBILITY
3311char
3312atomic_fetch_add_explicit(atomic_char* __obj, char __v, memory_order __o)
3313{
3314 return atomic_fetch_add_explicit(const_cast<volatile atomic_char*>(__obj),
3315 __v, __o);
3316}
3317
3318inline _LIBCPP_INLINE_VISIBILITY
3319char
3320atomic_fetch_sub(volatile atomic_char* __obj, char __v)
3321{
3322 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
3323}
3324
3325inline _LIBCPP_INLINE_VISIBILITY
3326char
3327atomic_fetch_sub(atomic_char* __obj, char __v)
3328{
3329 return atomic_fetch_sub(const_cast<volatile atomic_char*>(__obj), __v);
3330}
3331
3332inline _LIBCPP_INLINE_VISIBILITY
3333char
3334atomic_fetch_sub_explicit(volatile atomic_char* __obj, char __v,
3335 memory_order __o)
3336{
3337 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
3338}
3339
3340inline _LIBCPP_INLINE_VISIBILITY
3341char
3342atomic_fetch_sub_explicit(atomic_char* __obj, char __v, memory_order __o)
3343{
3344 return atomic_fetch_sub_explicit(const_cast<volatile atomic_char*>(__obj),
3345 __v, __o);
3346}
3347
3348inline _LIBCPP_INLINE_VISIBILITY
3349char
3350atomic_fetch_and(volatile atomic_char* __obj, char __v)
3351{
3352 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
3353}
3354
3355inline _LIBCPP_INLINE_VISIBILITY
3356char
3357atomic_fetch_and(atomic_char* __obj, char __v)
3358{
3359 return atomic_fetch_and(const_cast<volatile atomic_char*>(__obj), __v);
3360}
3361
3362inline _LIBCPP_INLINE_VISIBILITY
3363char
3364atomic_fetch_and_explicit(volatile atomic_char* __obj, char __v,
3365 memory_order __o)
3366{
3367 return __atomic_fetch_and(&__obj->__v_, __v, __o);
3368}
3369
3370inline _LIBCPP_INLINE_VISIBILITY
3371char
3372atomic_fetch_and_explicit(atomic_char* __obj, char __v, memory_order __o)
3373{
3374 return atomic_fetch_and_explicit(const_cast<volatile atomic_char*>(__obj),
3375 __v, __o);
3376}
3377
3378inline _LIBCPP_INLINE_VISIBILITY
3379char
3380atomic_fetch_or(volatile atomic_char* __obj, char __v)
3381{
3382 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
3383}
3384
3385inline _LIBCPP_INLINE_VISIBILITY
3386char
3387atomic_fetch_or(atomic_char* __obj, char __v)
3388{
3389 return atomic_fetch_or(const_cast<volatile atomic_char*>(__obj), __v);
3390}
3391
3392inline _LIBCPP_INLINE_VISIBILITY
3393char
3394atomic_fetch_or_explicit(volatile atomic_char* __obj, char __v,
3395 memory_order __o)
3396{
3397 return __atomic_fetch_or(&__obj->__v_, __v, __o);
3398}
3399
3400inline _LIBCPP_INLINE_VISIBILITY
3401char
3402atomic_fetch_or_explicit(atomic_char* __obj, char __v, memory_order __o)
3403{
3404 return atomic_fetch_or_explicit(const_cast<volatile atomic_char*>(__obj),
3405 __v, __o);
3406}
3407
3408inline _LIBCPP_INLINE_VISIBILITY
3409char
3410atomic_fetch_xor(volatile atomic_char* __obj, char __v)
3411{
3412 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
3413}
3414
3415inline _LIBCPP_INLINE_VISIBILITY
3416char
3417atomic_fetch_xor(atomic_char* __obj, char __v)
3418{
3419 return atomic_fetch_xor(const_cast<volatile atomic_char*>(__obj), __v);
3420}
3421
3422inline _LIBCPP_INLINE_VISIBILITY
3423char
3424atomic_fetch_xor_explicit(volatile atomic_char* __obj, char __v,
3425 memory_order __o)
3426{
3427 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
3428}
3429
3430inline _LIBCPP_INLINE_VISIBILITY
3431char
3432atomic_fetch_xor_explicit(atomic_char* __obj, char __v, memory_order __o)
3433{
3434 return atomic_fetch_xor_explicit(const_cast<volatile atomic_char*>(__obj),
3435 __v, __o);
3436}
3437
Howard Hinnant5bbe97d2010-10-19 21:22:10 +00003438// atomic_schar
3439
3440struct atomic_schar;
3441
3442bool atomic_is_lock_free(const volatile atomic_schar*);
3443bool atomic_is_lock_free(const atomic_schar*);
3444void atomic_init(volatile atomic_schar*, signed char);
3445void atomic_init(atomic_schar*, signed char);
3446void atomic_store(volatile atomic_schar*, signed char);
3447void atomic_store(atomic_schar*, signed char);
3448void atomic_store_explicit(volatile atomic_schar*, signed char, memory_order);
3449void atomic_store_explicit(atomic_schar*, signed char, memory_order);
3450signed char atomic_load(const volatile atomic_schar*);
3451signed char atomic_load(const atomic_schar*);
3452signed char atomic_load_explicit(const volatile atomic_schar*, memory_order);
3453signed char atomic_load_explicit(const atomic_schar*, memory_order);
3454signed char atomic_exchange(volatile atomic_schar*, signed char);
3455signed char atomic_exchange(atomic_schar*, signed char);
3456signed char atomic_exchange_explicit(volatile atomic_schar*, signed char,
3457 memory_order);
3458signed char atomic_exchange_explicit(atomic_schar*, signed char, memory_order);
3459bool atomic_compare_exchange_weak(volatile atomic_schar*, signed char*,
3460 signed char);
3461bool atomic_compare_exchange_weak(atomic_schar*, signed char*, signed char);
3462bool atomic_compare_exchange_strong(volatile atomic_schar*, signed char*,
3463 signed char);
3464bool atomic_compare_exchange_strong(atomic_schar*, signed char*, signed char);
3465bool atomic_compare_exchange_weak_explicit(volatile atomic_schar*, signed char*,
3466 signed char, memory_order,
3467 memory_order);
3468bool atomic_compare_exchange_weak_explicit(atomic_schar*, signed char*,
3469 signed char, memory_order,
3470 memory_order);
3471bool atomic_compare_exchange_strong_explicit(volatile atomic_schar*,
3472 signed char*, signed char,
3473 memory_order, memory_order);
3474bool atomic_compare_exchange_strong_explicit(atomic_schar*, signed char*,
3475 signed char, memory_order,
3476 memory_order);
3477signed char atomic_fetch_add(volatile atomic_schar*, signed char);
3478signed char atomic_fetch_add(atomic_schar*, signed char);
3479signed char atomic_fetch_add_explicit(volatile atomic_schar*, signed char,
3480 memory_order);
3481signed char atomic_fetch_add_explicit(atomic_schar*, signed char, memory_order);
3482signed char atomic_fetch_sub(volatile atomic_schar*, signed char);
3483signed char atomic_fetch_sub(atomic_schar*, signed char);
3484signed char atomic_fetch_sub_explicit(volatile atomic_schar*, signed char,
3485 memory_order);
3486signed char atomic_fetch_sub_explicit(atomic_schar*, signed char, memory_order);
3487signed char atomic_fetch_and(volatile atomic_schar*, signed char);
3488signed char atomic_fetch_and(atomic_schar*, signed char);
3489signed char atomic_fetch_and_explicit(volatile atomic_schar*, signed char,
3490 memory_order);
3491signed char atomic_fetch_and_explicit(atomic_schar*, signed char, memory_order);
3492signed char atomic_fetch_or(volatile atomic_schar*, signed char);
3493signed char atomic_fetch_or(atomic_schar*, signed char);
3494signed char atomic_fetch_or_explicit(volatile atomic_schar*, signed char,
3495 memory_order);
3496signed char atomic_fetch_or_explicit(atomic_schar*, signed char, memory_order);
3497signed char atomic_fetch_xor(volatile atomic_schar*, signed char);
3498signed char atomic_fetch_xor(atomic_schar*, signed char);
3499signed char atomic_fetch_xor_explicit(volatile atomic_schar*, signed char,
3500 memory_order);
3501signed char atomic_fetch_xor_explicit(atomic_schar*, signed char, memory_order);
3502
3503typedef struct atomic_schar
3504{
3505 signed char __v_;
3506
3507 _LIBCPP_INLINE_VISIBILITY
3508 bool is_lock_free() const volatile
3509 {return atomic_is_lock_free(this);}
3510 _LIBCPP_INLINE_VISIBILITY
3511 bool is_lock_free() const
3512 {return atomic_is_lock_free(this);}
3513 _LIBCPP_INLINE_VISIBILITY
3514 void store(signed char __v,
3515 memory_order __o = memory_order_seq_cst) volatile
3516 {atomic_store_explicit(this, __v, __o);}
3517 _LIBCPP_INLINE_VISIBILITY
3518 void store(signed char __v, memory_order __o = memory_order_seq_cst)
3519 {atomic_store_explicit(this, __v, __o);}
3520 _LIBCPP_INLINE_VISIBILITY
3521 signed char load(memory_order __o = memory_order_seq_cst) const volatile
3522 {return atomic_load_explicit(this, __o);}
3523 _LIBCPP_INLINE_VISIBILITY
3524 signed char load(memory_order __o = memory_order_seq_cst) const
3525 {return atomic_load_explicit(this, __o);}
3526 _LIBCPP_INLINE_VISIBILITY
3527 operator signed char() const volatile
3528 {return load();}
3529 _LIBCPP_INLINE_VISIBILITY
3530 operator signed char() const
3531 {return load();}
3532 _LIBCPP_INLINE_VISIBILITY
3533 signed char exchange(signed char __v,
3534 memory_order __o = memory_order_seq_cst) volatile
3535 {return atomic_exchange_explicit(this, __v, __o);}
3536 _LIBCPP_INLINE_VISIBILITY
3537 signed char exchange(signed char __v,
3538 memory_order __o = memory_order_seq_cst)
3539 {return atomic_exchange_explicit(this, __v, __o);}
3540 _LIBCPP_INLINE_VISIBILITY
3541 bool compare_exchange_weak(signed char& __v, signed char __e,
3542 memory_order __s, memory_order __f) volatile
3543 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
3544 __f);}
3545 _LIBCPP_INLINE_VISIBILITY
3546 bool compare_exchange_weak(signed char& __v, signed char __e,
3547 memory_order __s, memory_order __f)
3548 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
3549 __f);}
3550 _LIBCPP_INLINE_VISIBILITY
3551 bool compare_exchange_strong(signed char& __v, signed char __e,
3552 memory_order __s, memory_order __f) volatile
3553 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
3554 __f);}
3555 _LIBCPP_INLINE_VISIBILITY
3556 bool compare_exchange_strong(signed char& __v, signed char __e,
3557 memory_order __s, memory_order __f)
3558 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
3559 __f);}
3560 _LIBCPP_INLINE_VISIBILITY
3561 bool compare_exchange_weak(signed char& __v, signed char __e,
3562 memory_order __s = memory_order_seq_cst) volatile
3563 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
3564 __translate_memory_order(__s));}
3565 _LIBCPP_INLINE_VISIBILITY
3566 bool compare_exchange_weak(signed char& __v, signed char __e,
3567 memory_order __s = memory_order_seq_cst)
3568 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
3569 __translate_memory_order(__s));}
3570 _LIBCPP_INLINE_VISIBILITY
3571 bool compare_exchange_strong(signed char& __v, signed char __e,
3572 memory_order __s = memory_order_seq_cst) volatile
3573 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
3574 __translate_memory_order(__s));}
3575 _LIBCPP_INLINE_VISIBILITY
3576 bool compare_exchange_strong(signed char& __v, signed char __e,
3577 memory_order __s = memory_order_seq_cst)
3578 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
3579 __translate_memory_order(__s));}
3580 _LIBCPP_INLINE_VISIBILITY
3581 signed char fetch_add(signed char __v,
3582 memory_order __o = memory_order_seq_cst) volatile
3583 {return atomic_fetch_add_explicit(this, __v, __o);}
3584 _LIBCPP_INLINE_VISIBILITY
3585 signed char fetch_add(signed char __v,
3586 memory_order __o = memory_order_seq_cst)
3587 {return atomic_fetch_add_explicit(this, __v, __o);}
3588 _LIBCPP_INLINE_VISIBILITY
3589 signed char fetch_sub(signed char __v,
3590 memory_order __o = memory_order_seq_cst) volatile
3591 {return atomic_fetch_sub_explicit(this, __v, __o);}
3592 _LIBCPP_INLINE_VISIBILITY
3593 signed char fetch_sub(signed char __v,
3594 memory_order __o = memory_order_seq_cst)
3595 {return atomic_fetch_sub_explicit(this, __v, __o);}
3596 _LIBCPP_INLINE_VISIBILITY
3597 signed char fetch_and(signed char __v,
3598 memory_order __o = memory_order_seq_cst) volatile
3599 {return atomic_fetch_and_explicit(this, __v, __o);}
3600 _LIBCPP_INLINE_VISIBILITY
3601 signed char fetch_and(signed char __v,
3602 memory_order __o = memory_order_seq_cst)
3603 {return atomic_fetch_and_explicit(this, __v, __o);}
3604 _LIBCPP_INLINE_VISIBILITY
3605 signed char fetch_or(signed char __v,
3606 memory_order __o = memory_order_seq_cst) volatile
3607 {return atomic_fetch_or_explicit(this, __v, __o);}
3608 _LIBCPP_INLINE_VISIBILITY
3609 signed char fetch_or(signed char __v,
3610 memory_order __o = memory_order_seq_cst)
3611 {return atomic_fetch_or_explicit(this, __v, __o);}
3612 _LIBCPP_INLINE_VISIBILITY
3613 signed char fetch_xor(signed char __v,
3614 memory_order __o = memory_order_seq_cst) volatile
3615 {return atomic_fetch_xor_explicit(this, __v, __o);}
3616 _LIBCPP_INLINE_VISIBILITY
3617 signed char fetch_xor(signed char __v,
3618 memory_order __o = memory_order_seq_cst)
3619 {return atomic_fetch_xor_explicit(this, __v, __o);}
3620#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
3621 atomic_schar() = default;
3622#else
3623 _LIBCPP_INLINE_VISIBILITY
3624 atomic_schar() {}
3625#endif
3626 _LIBCPP_INLINE_VISIBILITY
3627 /*constexpr*/ atomic_schar(signed char __v)
3628 : __v_(__v) {}
3629#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
3630 atomic_schar(const atomic_schar&) = delete;
3631 atomic_schar& operator=(const atomic_schar&) = delete;
3632 atomic_schar& operator=(const atomic_schar&) volatile = delete;
3633#else
3634private:
3635 atomic_schar(const atomic_schar&);
3636 atomic_schar& operator=(const atomic_schar&);
3637 atomic_schar& operator=(const atomic_schar&) volatile;
3638public:
3639#endif
3640 _LIBCPP_INLINE_VISIBILITY
3641 signed char operator=(signed char __v) volatile
3642 {store(__v); return __v;}
3643 _LIBCPP_INLINE_VISIBILITY
3644 signed char operator=(signed char __v)
3645 {store(__v); return __v;}
3646 _LIBCPP_INLINE_VISIBILITY
3647 signed char operator++(int) volatile
3648 {typedef signed char type; return fetch_add(type(1));}
3649 _LIBCPP_INLINE_VISIBILITY
3650 char operator++(int)
3651 {typedef signed char type; return fetch_add(type(1));}
3652 _LIBCPP_INLINE_VISIBILITY
3653 char operator--(int) volatile
3654 {typedef signed char type; return fetch_sub(type(1));}
3655 _LIBCPP_INLINE_VISIBILITY
3656 char operator--(int)
3657 {typedef signed char type; return fetch_sub(type(1));}
3658 _LIBCPP_INLINE_VISIBILITY
3659 char operator++() volatile
3660 {typedef signed char type; return type(fetch_add(type(1)) + 1);}
3661 _LIBCPP_INLINE_VISIBILITY
3662 char operator++()
3663 {typedef signed char type; return type(fetch_add(type(1)) + 1);}
3664 _LIBCPP_INLINE_VISIBILITY
3665 char operator--() volatile
3666 {typedef signed char type; return type(fetch_sub(type(1)) - 1);}
3667 _LIBCPP_INLINE_VISIBILITY
3668 char operator--()
3669 {typedef signed char type; return type(fetch_sub(type(1)) - 1);}
3670 _LIBCPP_INLINE_VISIBILITY
3671 char operator+=(char __v) volatile
3672 {typedef signed char type; return type(fetch_add(__v) + __v);}
3673 _LIBCPP_INLINE_VISIBILITY
3674 char operator+=(char __v)
3675 {typedef signed char type; return type(fetch_add(__v) + __v);}
3676 _LIBCPP_INLINE_VISIBILITY
3677 char operator-=(char __v) volatile
3678 {typedef signed char type; return type(fetch_sub(__v) - __v);}
3679 _LIBCPP_INLINE_VISIBILITY
3680 char operator-=(char __v)
3681 {typedef signed char type; return type(fetch_sub(__v) - __v);}
3682 _LIBCPP_INLINE_VISIBILITY
3683 char operator&=(char __v) volatile
3684 {typedef signed char type; return type(fetch_and(__v) & __v);}
3685 _LIBCPP_INLINE_VISIBILITY
3686 char operator&=(char __v)
3687 {typedef signed char type; return type(fetch_and(__v) & __v);}
3688 _LIBCPP_INLINE_VISIBILITY
3689 char operator|=(char __v) volatile
3690 {typedef signed char type; return type(fetch_or(__v) | __v);}
3691 _LIBCPP_INLINE_VISIBILITY
3692 char operator|=(char __v)
3693 {typedef signed char type; return type(fetch_or(__v) | __v);}
3694 _LIBCPP_INLINE_VISIBILITY
3695 char operator^=(char __v) volatile
3696 {typedef signed char type; return type(fetch_xor(__v) ^ __v);}
3697 _LIBCPP_INLINE_VISIBILITY
3698 char operator^=(char __v)
3699 {typedef signed char type; return type(fetch_xor(__v) ^ __v);}
3700} atomic_schar;
3701
3702inline _LIBCPP_INLINE_VISIBILITY
3703bool
3704atomic_is_lock_free(const volatile atomic_schar*)
3705{
3706 typedef signed char type;
3707 return __atomic_is_lock_free(type);
3708}
3709
3710inline _LIBCPP_INLINE_VISIBILITY
3711bool
3712atomic_is_lock_free(const atomic_schar* __obj)
3713{
3714 return atomic_is_lock_free(const_cast<volatile atomic_schar*>(__obj));
3715}
3716
3717inline _LIBCPP_INLINE_VISIBILITY
3718void
3719atomic_init(volatile atomic_schar* __obj, signed char __desr)
3720{
3721 __obj->__v_ = __desr;
3722}
3723
3724inline _LIBCPP_INLINE_VISIBILITY
3725void
3726atomic_init(atomic_schar* __obj, signed char __desr)
3727{
3728 __obj->__v_ = __desr;
3729}
3730
3731inline _LIBCPP_INLINE_VISIBILITY
3732void
3733atomic_store(volatile atomic_schar* __obj, signed char __desr)
3734{
3735 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
3736}
3737
3738inline _LIBCPP_INLINE_VISIBILITY
3739void
3740atomic_store(atomic_schar* __obj, signed char __desr)
3741{
3742 atomic_store(const_cast<volatile atomic_schar*>(__obj), __desr);
3743}
3744
3745inline _LIBCPP_INLINE_VISIBILITY
3746void
3747atomic_store_explicit(volatile atomic_schar* __obj, signed char __desr,
3748 memory_order __o)
3749{
3750 __atomic_store(&__obj->__v_, __desr, __o);
3751}
3752
3753inline _LIBCPP_INLINE_VISIBILITY
3754void
3755atomic_store_explicit(atomic_schar* __obj, signed char __desr, memory_order __o)
3756{
3757 atomic_store_explicit(const_cast<volatile atomic_schar*>(__obj), __desr,
3758 __o);
3759}
3760
3761inline _LIBCPP_INLINE_VISIBILITY
3762signed char
3763atomic_load(const volatile atomic_schar* __obj)
3764{
3765 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
3766}
3767
3768inline _LIBCPP_INLINE_VISIBILITY
3769signed char
3770atomic_load(const atomic_schar* __obj)
3771{
3772 return atomic_load(const_cast<const volatile atomic_schar*>(__obj));
3773}
3774
3775inline _LIBCPP_INLINE_VISIBILITY
3776signed char
3777atomic_load_explicit(const volatile atomic_schar* __obj, memory_order __o)
3778{
3779 return __atomic_load(&__obj->__v_, __o);
3780}
3781
3782inline _LIBCPP_INLINE_VISIBILITY
3783signed char
3784atomic_load_explicit(const atomic_schar* __obj, memory_order __o)
3785{
3786 return atomic_load_explicit(const_cast<const volatile atomic_schar*>
3787 (__obj), __o);
3788}
3789
3790inline _LIBCPP_INLINE_VISIBILITY
3791signed char
3792atomic_exchange(volatile atomic_schar* __obj, signed char __desr)
3793{
3794 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
3795}
3796
3797inline _LIBCPP_INLINE_VISIBILITY
3798signed char
3799atomic_exchange(atomic_schar* __obj, signed char __desr)
3800{
3801 return atomic_exchange(const_cast<volatile atomic_schar*>(__obj), __desr);
3802}
3803
3804inline _LIBCPP_INLINE_VISIBILITY
3805signed char
3806atomic_exchange_explicit(volatile atomic_schar* __obj, signed char __desr,
3807 memory_order __o)
3808{
3809 return __atomic_exchange(&__obj->__v_, __desr, __o);
3810}
3811
3812inline _LIBCPP_INLINE_VISIBILITY
3813signed char
3814atomic_exchange_explicit(atomic_schar* __obj, signed char __desr,
3815 memory_order __o)
3816{
3817 return atomic_exchange_explicit(const_cast<volatile atomic_schar*>
3818 (__obj), __desr, __o);
3819}
3820
3821inline _LIBCPP_INLINE_VISIBILITY
3822bool
3823atomic_compare_exchange_weak(volatile atomic_schar* __obj, signed char* __exp,
3824 signed char __desr)
3825{
3826 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
3827 memory_order_seq_cst, memory_order_seq_cst);
3828}
3829
3830inline _LIBCPP_INLINE_VISIBILITY
3831bool
3832atomic_compare_exchange_weak(atomic_schar* __obj, signed char* __exp,
3833 signed char __desr)
3834{
3835 return atomic_compare_exchange_weak(const_cast<volatile atomic_schar*>
3836 (__obj), __exp, __desr);
3837}
3838
3839inline _LIBCPP_INLINE_VISIBILITY
3840bool
3841atomic_compare_exchange_strong(volatile atomic_schar* __obj, signed char* __exp,
3842 signed char __desr)
3843{
3844 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
3845 memory_order_seq_cst, memory_order_seq_cst);
3846}
3847
3848inline _LIBCPP_INLINE_VISIBILITY
3849bool
3850atomic_compare_exchange_strong(atomic_schar* __obj, signed char* __exp,
3851 signed char __desr)
3852{
3853 return atomic_compare_exchange_strong(const_cast<volatile atomic_schar*>
3854 (__obj), __exp, __desr);
3855}
3856
3857inline _LIBCPP_INLINE_VISIBILITY
3858bool
3859atomic_compare_exchange_weak_explicit(volatile atomic_schar* __obj,
3860 signed char* __exp, signed char __desr,
3861 memory_order __s, memory_order __f)
3862{
3863 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
3864 __f);
3865}
3866
3867inline _LIBCPP_INLINE_VISIBILITY
3868bool
3869atomic_compare_exchange_weak_explicit(atomic_schar* __obj, signed char* __exp,
3870 signed char __desr, memory_order __s,
3871 memory_order __f)
3872{
3873 return atomic_compare_exchange_weak_explicit(
3874 const_cast<volatile atomic_schar*>(__obj), __exp, __desr, __s, __f);
3875}
3876
3877inline _LIBCPP_INLINE_VISIBILITY
3878bool
3879atomic_compare_exchange_strong_explicit(volatile atomic_schar* __obj,
3880 signed char* __exp, signed char __desr,
3881 memory_order __s, memory_order __f)
3882{
3883 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
3884 __f);
3885}
3886
3887inline _LIBCPP_INLINE_VISIBILITY
3888bool
3889atomic_compare_exchange_strong_explicit(atomic_schar* __obj, signed char* __exp,
3890 signed char __desr, memory_order __s,
3891 memory_order __f)
3892{
3893 return atomic_compare_exchange_strong_explicit(
3894 const_cast<volatile atomic_schar*>(__obj), __exp, __desr, __s, __f);
3895}
3896
3897inline _LIBCPP_INLINE_VISIBILITY
3898signed char
3899atomic_fetch_add(volatile atomic_schar* __obj, signed char __v)
3900{
3901 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
3902}
3903
3904inline _LIBCPP_INLINE_VISIBILITY
3905signed char
3906atomic_fetch_add(atomic_schar* __obj, signed char __v)
3907{
3908 return atomic_fetch_add(const_cast<volatile atomic_schar*>(__obj), __v);
3909}
3910
3911inline _LIBCPP_INLINE_VISIBILITY
3912signed char
3913atomic_fetch_add_explicit(volatile atomic_schar* __obj, signed char __v,
3914 memory_order __o)
3915{
3916 return __atomic_fetch_add(&__obj->__v_, __v, __o);
3917}
3918
3919inline _LIBCPP_INLINE_VISIBILITY
3920signed char
3921atomic_fetch_add_explicit(atomic_schar* __obj, signed char __v,
3922 memory_order __o)
3923{
3924 return atomic_fetch_add_explicit(const_cast<volatile atomic_schar*>(__obj),
3925 __v, __o);
3926}
3927
3928inline _LIBCPP_INLINE_VISIBILITY
3929signed char
3930atomic_fetch_sub(volatile atomic_schar* __obj, signed char __v)
3931{
3932 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
3933}
3934
3935inline _LIBCPP_INLINE_VISIBILITY
3936signed char
3937atomic_fetch_sub(atomic_schar* __obj, signed char __v)
3938{
3939 return atomic_fetch_sub(const_cast<volatile atomic_schar*>(__obj), __v);
3940}
3941
3942inline _LIBCPP_INLINE_VISIBILITY
3943signed char
3944atomic_fetch_sub_explicit(volatile atomic_schar* __obj, signed char __v,
3945 memory_order __o)
3946{
3947 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
3948}
3949
3950inline _LIBCPP_INLINE_VISIBILITY
3951signed char
3952atomic_fetch_sub_explicit(atomic_schar* __obj, signed char __v,
3953 memory_order __o)
3954{
3955 return atomic_fetch_sub_explicit(const_cast<volatile atomic_schar*>(__obj),
3956 __v, __o);
3957}
3958
3959inline _LIBCPP_INLINE_VISIBILITY
3960signed char
3961atomic_fetch_and(volatile atomic_schar* __obj, signed char __v)
3962{
3963 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
3964}
3965
3966inline _LIBCPP_INLINE_VISIBILITY
3967signed char
3968atomic_fetch_and(atomic_schar* __obj, signed char __v)
3969{
3970 return atomic_fetch_and(const_cast<volatile atomic_schar*>(__obj), __v);
3971}
3972
3973inline _LIBCPP_INLINE_VISIBILITY
3974signed char
3975atomic_fetch_and_explicit(volatile atomic_schar* __obj, signed char __v,
3976 memory_order __o)
3977{
3978 return __atomic_fetch_and(&__obj->__v_, __v, __o);
3979}
3980
3981inline _LIBCPP_INLINE_VISIBILITY
3982signed char
3983atomic_fetch_and_explicit(atomic_schar* __obj, signed char __v,
3984 memory_order __o)
3985{
3986 return atomic_fetch_and_explicit(const_cast<volatile atomic_schar*>(__obj),
3987 __v, __o);
3988}
3989
3990inline _LIBCPP_INLINE_VISIBILITY
3991signed char
3992atomic_fetch_or(volatile atomic_schar* __obj, signed char __v)
3993{
3994 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
3995}
3996
3997inline _LIBCPP_INLINE_VISIBILITY
3998signed char
3999atomic_fetch_or(atomic_schar* __obj, signed char __v)
4000{
4001 return atomic_fetch_or(const_cast<volatile atomic_schar*>(__obj), __v);
4002}
4003
4004inline _LIBCPP_INLINE_VISIBILITY
4005signed char
4006atomic_fetch_or_explicit(volatile atomic_schar* __obj, signed char __v,
4007 memory_order __o)
4008{
4009 return __atomic_fetch_or(&__obj->__v_, __v, __o);
4010}
4011
4012inline _LIBCPP_INLINE_VISIBILITY
4013signed char
4014atomic_fetch_or_explicit(atomic_schar* __obj, signed char __v, memory_order __o)
4015{
4016 return atomic_fetch_or_explicit(const_cast<volatile atomic_schar*>(__obj),
4017 __v, __o);
4018}
4019
4020inline _LIBCPP_INLINE_VISIBILITY
4021signed char
4022atomic_fetch_xor(volatile atomic_schar* __obj, signed char __v)
4023{
4024 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
4025}
4026
4027inline _LIBCPP_INLINE_VISIBILITY
4028signed char
4029atomic_fetch_xor(atomic_schar* __obj, signed char __v)
4030{
4031 return atomic_fetch_xor(const_cast<volatile atomic_schar*>(__obj), __v);
4032}
4033
4034inline _LIBCPP_INLINE_VISIBILITY
4035signed char
4036atomic_fetch_xor_explicit(volatile atomic_schar* __obj, signed char __v,
4037 memory_order __o)
4038{
4039 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
4040}
4041
4042inline _LIBCPP_INLINE_VISIBILITY
4043signed char
4044atomic_fetch_xor_explicit(atomic_schar* __obj, signed char __v,
4045 memory_order __o)
4046{
4047 return atomic_fetch_xor_explicit(const_cast<volatile atomic_schar*>(__obj),
4048 __v, __o);
4049}
4050
4051// atomic_uchar
4052
4053struct atomic_uchar;
4054
4055bool atomic_is_lock_free(const volatile atomic_uchar*);
4056bool atomic_is_lock_free(const atomic_uchar*);
4057void atomic_init(volatile atomic_uchar*, unsigned char);
4058void atomic_init(atomic_uchar*, unsigned char);
4059void atomic_store(volatile atomic_uchar*, unsigned char);
4060void atomic_store(atomic_uchar*, unsigned char);
4061void atomic_store_explicit(volatile atomic_uchar*, unsigned char, memory_order);
4062void atomic_store_explicit(atomic_uchar*, unsigned char, memory_order);
4063unsigned char atomic_load(const volatile atomic_uchar*);
4064unsigned char atomic_load(const atomic_uchar*);
4065unsigned char atomic_load_explicit(const volatile atomic_uchar*, memory_order);
4066unsigned char atomic_load_explicit(const atomic_uchar*, memory_order);
4067unsigned char atomic_exchange(volatile atomic_uchar*, unsigned char);
4068unsigned char atomic_exchange(atomic_uchar*, unsigned char);
4069unsigned char atomic_exchange_explicit(volatile atomic_uchar*, unsigned char,
4070 memory_order);
4071unsigned char atomic_exchange_explicit(atomic_uchar*, unsigned char,
4072 memory_order);
4073bool atomic_compare_exchange_weak(volatile atomic_uchar*, unsigned char*,
4074 unsigned char);
4075bool atomic_compare_exchange_weak(atomic_uchar*, unsigned char*, unsigned char);
4076bool atomic_compare_exchange_strong(volatile atomic_uchar*, unsigned char*,
4077 unsigned char);
4078bool atomic_compare_exchange_strong(atomic_uchar*, unsigned char*,
4079 unsigned char);
4080bool atomic_compare_exchange_weak_explicit(volatile atomic_uchar*,
4081 unsigned char*, unsigned char,
4082 memory_order, memory_order);
4083bool atomic_compare_exchange_weak_explicit(atomic_uchar*, unsigned char*,
4084 unsigned char, memory_order,
4085 memory_order);
4086bool atomic_compare_exchange_strong_explicit(volatile atomic_uchar*,
4087 unsigned char*, unsigned char,
4088 memory_order, memory_order);
4089bool atomic_compare_exchange_strong_explicit(atomic_uchar*, unsigned char*,
4090 unsigned char, memory_order,
4091 memory_order);
4092unsigned char atomic_fetch_add(volatile atomic_uchar*, unsigned char);
4093unsigned char atomic_fetch_add(atomic_uchar*, unsigned char);
4094unsigned char atomic_fetch_add_explicit(volatile atomic_uchar*, unsigned char,
4095 memory_order);
4096unsigned char atomic_fetch_add_explicit(atomic_uchar*, unsigned char,
4097 memory_order);
4098unsigned char atomic_fetch_sub(volatile atomic_uchar*, unsigned char);
4099unsigned char atomic_fetch_sub(atomic_uchar*, unsigned char);
4100unsigned char atomic_fetch_sub_explicit(volatile atomic_uchar*, unsigned char,
4101 memory_order);
4102unsigned char atomic_fetch_sub_explicit(atomic_uchar*, unsigned char,
4103 memory_order);
4104unsigned char atomic_fetch_and(volatile atomic_uchar*, unsigned char);
4105unsigned char atomic_fetch_and(atomic_uchar*, unsigned char);
4106unsigned char atomic_fetch_and_explicit(volatile atomic_uchar*, unsigned char,
4107 memory_order);
4108unsigned char atomic_fetch_and_explicit(atomic_uchar*, unsigned char,
4109 memory_order);
4110unsigned char atomic_fetch_or(volatile atomic_uchar*, unsigned char);
4111unsigned char atomic_fetch_or(atomic_uchar*, unsigned char);
4112unsigned char atomic_fetch_or_explicit(volatile atomic_uchar*, unsigned char,
4113 memory_order);
4114unsigned char atomic_fetch_or_explicit(atomic_uchar*, unsigned char,
4115 memory_order);
4116unsigned char atomic_fetch_xor(volatile atomic_uchar*, unsigned char);
4117unsigned char atomic_fetch_xor(atomic_uchar*, unsigned char);
4118unsigned char atomic_fetch_xor_explicit(volatile atomic_uchar*, unsigned char,
4119 memory_order);
4120unsigned char atomic_fetch_xor_explicit(atomic_uchar*, unsigned char,
4121 memory_order);
4122
4123typedef struct atomic_uchar
4124{
4125 unsigned char __v_;
4126
4127 _LIBCPP_INLINE_VISIBILITY
4128 bool is_lock_free() const volatile
4129 {return atomic_is_lock_free(this);}
4130 _LIBCPP_INLINE_VISIBILITY
4131 bool is_lock_free() const
4132 {return atomic_is_lock_free(this);}
4133 _LIBCPP_INLINE_VISIBILITY
4134 void store(unsigned char __v,
4135 memory_order __o = memory_order_seq_cst) volatile
4136 {atomic_store_explicit(this, __v, __o);}
4137 _LIBCPP_INLINE_VISIBILITY
4138 void store(unsigned char __v, memory_order __o = memory_order_seq_cst)
4139 {atomic_store_explicit(this, __v, __o);}
4140 _LIBCPP_INLINE_VISIBILITY
4141 unsigned char load(memory_order __o = memory_order_seq_cst) const volatile
4142 {return atomic_load_explicit(this, __o);}
4143 _LIBCPP_INLINE_VISIBILITY
4144 unsigned char load(memory_order __o = memory_order_seq_cst) const
4145 {return atomic_load_explicit(this, __o);}
4146 _LIBCPP_INLINE_VISIBILITY
4147 operator unsigned char() const volatile
4148 {return load();}
4149 _LIBCPP_INLINE_VISIBILITY
4150 operator unsigned char() const
4151 {return load();}
4152 _LIBCPP_INLINE_VISIBILITY
4153 unsigned char exchange(unsigned char __v,
4154 memory_order __o = memory_order_seq_cst) volatile
4155 {return atomic_exchange_explicit(this, __v, __o);}
4156 _LIBCPP_INLINE_VISIBILITY
4157 unsigned char exchange(unsigned char __v,
4158 memory_order __o = memory_order_seq_cst)
4159 {return atomic_exchange_explicit(this, __v, __o);}
4160 _LIBCPP_INLINE_VISIBILITY
4161 bool compare_exchange_weak(unsigned char& __v, unsigned char __e,
4162 memory_order __s, memory_order __f) volatile
4163 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
4164 __f);}
4165 _LIBCPP_INLINE_VISIBILITY
4166 bool compare_exchange_weak(unsigned char& __v, unsigned char __e,
4167 memory_order __s, memory_order __f)
4168 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
4169 __f);}
4170 _LIBCPP_INLINE_VISIBILITY
4171 bool compare_exchange_strong(unsigned char& __v, unsigned char __e,
4172 memory_order __s, memory_order __f) volatile
4173 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
4174 __f);}
4175 _LIBCPP_INLINE_VISIBILITY
4176 bool compare_exchange_strong(unsigned char& __v, unsigned char __e,
4177 memory_order __s, memory_order __f)
4178 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
4179 __f);}
4180 _LIBCPP_INLINE_VISIBILITY
4181 bool compare_exchange_weak(unsigned char& __v, unsigned char __e,
4182 memory_order __s = memory_order_seq_cst) volatile
4183 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
4184 __translate_memory_order(__s));}
4185 _LIBCPP_INLINE_VISIBILITY
4186 bool compare_exchange_weak(unsigned char& __v, unsigned char __e,
4187 memory_order __s = memory_order_seq_cst)
4188 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
4189 __translate_memory_order(__s));}
4190 _LIBCPP_INLINE_VISIBILITY
4191 bool compare_exchange_strong(unsigned char& __v, unsigned char __e,
4192 memory_order __s = memory_order_seq_cst) volatile
4193 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
4194 __translate_memory_order(__s));}
4195 _LIBCPP_INLINE_VISIBILITY
4196 bool compare_exchange_strong(unsigned char& __v, unsigned char __e,
4197 memory_order __s = memory_order_seq_cst)
4198 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
4199 __translate_memory_order(__s));}
4200 _LIBCPP_INLINE_VISIBILITY
4201 unsigned char fetch_add(unsigned char __v,
4202 memory_order __o = memory_order_seq_cst) volatile
4203 {return atomic_fetch_add_explicit(this, __v, __o);}
4204 _LIBCPP_INLINE_VISIBILITY
4205 unsigned char fetch_add(unsigned char __v,
4206 memory_order __o = memory_order_seq_cst)
4207 {return atomic_fetch_add_explicit(this, __v, __o);}
4208 _LIBCPP_INLINE_VISIBILITY
4209 unsigned char fetch_sub(unsigned char __v,
4210 memory_order __o = memory_order_seq_cst) volatile
4211 {return atomic_fetch_sub_explicit(this, __v, __o);}
4212 _LIBCPP_INLINE_VISIBILITY
4213 unsigned char fetch_sub(unsigned char __v,
4214 memory_order __o = memory_order_seq_cst)
4215 {return atomic_fetch_sub_explicit(this, __v, __o);}
4216 _LIBCPP_INLINE_VISIBILITY
4217 unsigned char fetch_and(unsigned char __v,
4218 memory_order __o = memory_order_seq_cst) volatile
4219 {return atomic_fetch_and_explicit(this, __v, __o);}
4220 _LIBCPP_INLINE_VISIBILITY
4221 unsigned char fetch_and(unsigned char __v,
4222 memory_order __o = memory_order_seq_cst)
4223 {return atomic_fetch_and_explicit(this, __v, __o);}
4224 _LIBCPP_INLINE_VISIBILITY
4225 unsigned char fetch_or(unsigned char __v,
4226 memory_order __o = memory_order_seq_cst) volatile
4227 {return atomic_fetch_or_explicit(this, __v, __o);}
4228 _LIBCPP_INLINE_VISIBILITY
4229 unsigned char fetch_or(unsigned char __v,
4230 memory_order __o = memory_order_seq_cst)
4231 {return atomic_fetch_or_explicit(this, __v, __o);}
4232 _LIBCPP_INLINE_VISIBILITY
4233 unsigned char fetch_xor(unsigned char __v,
4234 memory_order __o = memory_order_seq_cst) volatile
4235 {return atomic_fetch_xor_explicit(this, __v, __o);}
4236 _LIBCPP_INLINE_VISIBILITY
4237 unsigned char fetch_xor(unsigned char __v,
4238 memory_order __o = memory_order_seq_cst)
4239 {return atomic_fetch_xor_explicit(this, __v, __o);}
4240#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
4241 atomic_uchar() = default;
4242#else
4243 _LIBCPP_INLINE_VISIBILITY
4244 atomic_uchar() {}
4245#endif
4246 _LIBCPP_INLINE_VISIBILITY
4247 /*constexpr*/ atomic_uchar(unsigned char __v)
4248 : __v_(__v) {}
4249#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
4250 atomic_uchar(const atomic_uchar&) = delete;
4251 atomic_uchar& operator=(const atomic_uchar&) = delete;
4252 atomic_uchar& operator=(const atomic_uchar&) volatile = delete;
4253#else
4254private:
4255 atomic_uchar(const atomic_uchar&);
4256 atomic_uchar& operator=(const atomic_uchar&);
4257 atomic_uchar& operator=(const atomic_uchar&) volatile;
4258public:
4259#endif
4260 _LIBCPP_INLINE_VISIBILITY
4261 unsigned char operator=(unsigned char __v) volatile
4262 {store(__v); return __v;}
4263 _LIBCPP_INLINE_VISIBILITY
4264 unsigned char operator=(unsigned char __v)
4265 {store(__v); return __v;}
4266 _LIBCPP_INLINE_VISIBILITY
4267 unsigned char operator++(int) volatile
4268 {typedef unsigned char type; return fetch_add(type(1));}
4269 _LIBCPP_INLINE_VISIBILITY
4270 char operator++(int)
4271 {typedef unsigned char type; return fetch_add(type(1));}
4272 _LIBCPP_INLINE_VISIBILITY
4273 char operator--(int) volatile
4274 {typedef unsigned char type; return fetch_sub(type(1));}
4275 _LIBCPP_INLINE_VISIBILITY
4276 char operator--(int)
4277 {typedef unsigned char type; return fetch_sub(type(1));}
4278 _LIBCPP_INLINE_VISIBILITY
4279 char operator++() volatile
4280 {typedef unsigned char type; return type(fetch_add(type(1)) + 1);}
4281 _LIBCPP_INLINE_VISIBILITY
4282 char operator++()
4283 {typedef unsigned char type; return type(fetch_add(type(1)) + 1);}
4284 _LIBCPP_INLINE_VISIBILITY
4285 char operator--() volatile
4286 {typedef unsigned char type; return type(fetch_sub(type(1)) - 1);}
4287 _LIBCPP_INLINE_VISIBILITY
4288 char operator--()
4289 {typedef unsigned char type; return type(fetch_sub(type(1)) - 1);}
4290 _LIBCPP_INLINE_VISIBILITY
4291 char operator+=(char __v) volatile
4292 {typedef unsigned char type; return type(fetch_add(__v) + __v);}
4293 _LIBCPP_INLINE_VISIBILITY
4294 char operator+=(char __v)
4295 {typedef unsigned char type; return type(fetch_add(__v) + __v);}
4296 _LIBCPP_INLINE_VISIBILITY
4297 char operator-=(char __v) volatile
4298 {typedef unsigned char type; return type(fetch_sub(__v) - __v);}
4299 _LIBCPP_INLINE_VISIBILITY
4300 char operator-=(char __v)
4301 {typedef unsigned char type; return type(fetch_sub(__v) - __v);}
4302 _LIBCPP_INLINE_VISIBILITY
4303 char operator&=(char __v) volatile
4304 {typedef unsigned char type; return type(fetch_and(__v) & __v);}
4305 _LIBCPP_INLINE_VISIBILITY
4306 char operator&=(char __v)
4307 {typedef unsigned char type; return type(fetch_and(__v) & __v);}
4308 _LIBCPP_INLINE_VISIBILITY
4309 char operator|=(char __v) volatile
4310 {typedef unsigned char type; return type(fetch_or(__v) | __v);}
4311 _LIBCPP_INLINE_VISIBILITY
4312 char operator|=(char __v)
4313 {typedef unsigned char type; return type(fetch_or(__v) | __v);}
4314 _LIBCPP_INLINE_VISIBILITY
4315 char operator^=(char __v) volatile
4316 {typedef unsigned char type; return type(fetch_xor(__v) ^ __v);}
4317 _LIBCPP_INLINE_VISIBILITY
4318 char operator^=(char __v)
4319 {typedef unsigned char type; return type(fetch_xor(__v) ^ __v);}
4320} atomic_uchar;
4321
4322inline _LIBCPP_INLINE_VISIBILITY
4323bool
4324atomic_is_lock_free(const volatile atomic_uchar*)
4325{
4326 typedef unsigned char type;
4327 return __atomic_is_lock_free(type);
4328}
4329
4330inline _LIBCPP_INLINE_VISIBILITY
4331bool
4332atomic_is_lock_free(const atomic_uchar* __obj)
4333{
4334 return atomic_is_lock_free(const_cast<volatile atomic_uchar*>(__obj));
4335}
4336
4337inline _LIBCPP_INLINE_VISIBILITY
4338void
4339atomic_init(volatile atomic_uchar* __obj, unsigned char __desr)
4340{
4341 __obj->__v_ = __desr;
4342}
4343
4344inline _LIBCPP_INLINE_VISIBILITY
4345void
4346atomic_init(atomic_uchar* __obj, unsigned char __desr)
4347{
4348 __obj->__v_ = __desr;
4349}
4350
4351inline _LIBCPP_INLINE_VISIBILITY
4352void
4353atomic_store(volatile atomic_uchar* __obj, unsigned char __desr)
4354{
4355 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
4356}
4357
4358inline _LIBCPP_INLINE_VISIBILITY
4359void
4360atomic_store(atomic_uchar* __obj, unsigned char __desr)
4361{
4362 atomic_store(const_cast<volatile atomic_uchar*>(__obj), __desr);
4363}
4364
4365inline _LIBCPP_INLINE_VISIBILITY
4366void
4367atomic_store_explicit(volatile atomic_uchar* __obj, unsigned char __desr,
4368 memory_order __o)
4369{
4370 __atomic_store(&__obj->__v_, __desr, __o);
4371}
4372
4373inline _LIBCPP_INLINE_VISIBILITY
4374void
4375atomic_store_explicit(atomic_uchar* __obj, unsigned char __desr,
4376 memory_order __o)
4377{
4378 atomic_store_explicit(const_cast<volatile atomic_uchar*>(__obj), __desr,
4379 __o);
4380}
4381
4382inline _LIBCPP_INLINE_VISIBILITY
4383unsigned char
4384atomic_load(const volatile atomic_uchar* __obj)
4385{
4386 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
4387}
4388
4389inline _LIBCPP_INLINE_VISIBILITY
4390unsigned char
4391atomic_load(const atomic_uchar* __obj)
4392{
4393 return atomic_load(const_cast<const volatile atomic_uchar*>(__obj));
4394}
4395
4396inline _LIBCPP_INLINE_VISIBILITY
4397unsigned char
4398atomic_load_explicit(const volatile atomic_uchar* __obj, memory_order __o)
4399{
4400 return __atomic_load(&__obj->__v_, __o);
4401}
4402
4403inline _LIBCPP_INLINE_VISIBILITY
4404unsigned char
4405atomic_load_explicit(const atomic_uchar* __obj, memory_order __o)
4406{
4407 return atomic_load_explicit(const_cast<const volatile atomic_uchar*>
4408 (__obj), __o);
4409}
4410
4411inline _LIBCPP_INLINE_VISIBILITY
4412unsigned char
4413atomic_exchange(volatile atomic_uchar* __obj, unsigned char __desr)
4414{
4415 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
4416}
4417
4418inline _LIBCPP_INLINE_VISIBILITY
4419unsigned char
4420atomic_exchange(atomic_uchar* __obj, unsigned char __desr)
4421{
4422 return atomic_exchange(const_cast<volatile atomic_uchar*>(__obj), __desr);
4423}
4424
4425inline _LIBCPP_INLINE_VISIBILITY
4426unsigned char
4427atomic_exchange_explicit(volatile atomic_uchar* __obj, unsigned char __desr,
4428 memory_order __o)
4429{
4430 return __atomic_exchange(&__obj->__v_, __desr, __o);
4431}
4432
4433inline _LIBCPP_INLINE_VISIBILITY
4434unsigned char
4435atomic_exchange_explicit(atomic_uchar* __obj, unsigned char __desr,
4436 memory_order __o)
4437{
4438 return atomic_exchange_explicit(const_cast<volatile atomic_uchar*>
4439 (__obj), __desr, __o);
4440}
4441
4442inline _LIBCPP_INLINE_VISIBILITY
4443bool
4444atomic_compare_exchange_weak(volatile atomic_uchar* __obj, unsigned char* __exp,
4445 unsigned char __desr)
4446{
4447 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
4448 memory_order_seq_cst, memory_order_seq_cst);
4449}
4450
4451inline _LIBCPP_INLINE_VISIBILITY
4452bool
4453atomic_compare_exchange_weak(atomic_uchar* __obj, unsigned char* __exp,
4454 unsigned char __desr)
4455{
4456 return atomic_compare_exchange_weak(const_cast<volatile atomic_uchar*>
4457 (__obj), __exp, __desr);
4458}
4459
4460inline _LIBCPP_INLINE_VISIBILITY
4461bool
4462atomic_compare_exchange_strong(volatile atomic_uchar* __obj,
4463 unsigned char* __exp, unsigned char __desr)
4464{
4465 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
4466 memory_order_seq_cst, memory_order_seq_cst);
4467}
4468
4469inline _LIBCPP_INLINE_VISIBILITY
4470bool
4471atomic_compare_exchange_strong(atomic_uchar* __obj, unsigned char* __exp,
4472 unsigned char __desr)
4473{
4474 return atomic_compare_exchange_strong(const_cast<volatile atomic_uchar*>
4475 (__obj), __exp, __desr);
4476}
4477
4478inline _LIBCPP_INLINE_VISIBILITY
4479bool
4480atomic_compare_exchange_weak_explicit(volatile atomic_uchar* __obj,
4481 unsigned char* __exp,
4482 unsigned char __desr, memory_order __s,
4483 memory_order __f)
4484{
4485 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
4486 __f);
4487}
4488
4489inline _LIBCPP_INLINE_VISIBILITY
4490bool
4491atomic_compare_exchange_weak_explicit(atomic_uchar* __obj, unsigned char* __exp,
4492 unsigned char __desr, memory_order __s,
4493 memory_order __f)
4494{
4495 return atomic_compare_exchange_weak_explicit(
4496 const_cast<volatile atomic_uchar*>(__obj), __exp, __desr, __s, __f);
4497}
4498
4499inline _LIBCPP_INLINE_VISIBILITY
4500bool
4501atomic_compare_exchange_strong_explicit(volatile atomic_uchar* __obj,
4502 unsigned char* __exp,
4503 unsigned char __desr, memory_order __s,
4504 memory_order __f)
4505{
4506 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
4507 __f);
4508}
4509
4510inline _LIBCPP_INLINE_VISIBILITY
4511bool
4512atomic_compare_exchange_strong_explicit(atomic_uchar* __obj,
4513 unsigned char* __exp,
4514 unsigned char __desr, memory_order __s,
4515 memory_order __f)
4516{
4517 return atomic_compare_exchange_strong_explicit(
4518 const_cast<volatile atomic_uchar*>(__obj), __exp, __desr, __s, __f);
4519}
4520
4521inline _LIBCPP_INLINE_VISIBILITY
4522unsigned char
4523atomic_fetch_add(volatile atomic_uchar* __obj, unsigned char __v)
4524{
4525 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
4526}
4527
4528inline _LIBCPP_INLINE_VISIBILITY
4529unsigned char
4530atomic_fetch_add(atomic_uchar* __obj, unsigned char __v)
4531{
4532 return atomic_fetch_add(const_cast<volatile atomic_uchar*>(__obj), __v);
4533}
4534
4535inline _LIBCPP_INLINE_VISIBILITY
4536unsigned char
4537atomic_fetch_add_explicit(volatile atomic_uchar* __obj, unsigned char __v,
4538 memory_order __o)
4539{
4540 return __atomic_fetch_add(&__obj->__v_, __v, __o);
4541}
4542
4543inline _LIBCPP_INLINE_VISIBILITY
4544unsigned char
4545atomic_fetch_add_explicit(atomic_uchar* __obj, unsigned char __v,
4546 memory_order __o)
4547{
4548 return atomic_fetch_add_explicit(const_cast<volatile atomic_uchar*>(__obj),
4549 __v, __o);
4550}
4551
4552inline _LIBCPP_INLINE_VISIBILITY
4553unsigned char
4554atomic_fetch_sub(volatile atomic_uchar* __obj, unsigned char __v)
4555{
4556 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
4557}
4558
4559inline _LIBCPP_INLINE_VISIBILITY
4560unsigned char
4561atomic_fetch_sub(atomic_uchar* __obj, unsigned char __v)
4562{
4563 return atomic_fetch_sub(const_cast<volatile atomic_uchar*>(__obj), __v);
4564}
4565
4566inline _LIBCPP_INLINE_VISIBILITY
4567unsigned char
4568atomic_fetch_sub_explicit(volatile atomic_uchar* __obj, unsigned char __v,
4569 memory_order __o)
4570{
4571 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
4572}
4573
4574inline _LIBCPP_INLINE_VISIBILITY
4575unsigned char
4576atomic_fetch_sub_explicit(atomic_uchar* __obj, unsigned char __v,
4577 memory_order __o)
4578{
4579 return atomic_fetch_sub_explicit(const_cast<volatile atomic_uchar*>(__obj),
4580 __v, __o);
4581}
4582
4583inline _LIBCPP_INLINE_VISIBILITY
4584unsigned char
4585atomic_fetch_and(volatile atomic_uchar* __obj, unsigned char __v)
4586{
4587 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
4588}
4589
4590inline _LIBCPP_INLINE_VISIBILITY
4591unsigned char
4592atomic_fetch_and(atomic_uchar* __obj, unsigned char __v)
4593{
4594 return atomic_fetch_and(const_cast<volatile atomic_uchar*>(__obj), __v);
4595}
4596
4597inline _LIBCPP_INLINE_VISIBILITY
4598unsigned char
4599atomic_fetch_and_explicit(volatile atomic_uchar* __obj, unsigned char __v,
4600 memory_order __o)
4601{
4602 return __atomic_fetch_and(&__obj->__v_, __v, __o);
4603}
4604
4605inline _LIBCPP_INLINE_VISIBILITY
4606unsigned char
4607atomic_fetch_and_explicit(atomic_uchar* __obj, unsigned char __v,
4608 memory_order __o)
4609{
4610 return atomic_fetch_and_explicit(const_cast<volatile atomic_uchar*>(__obj),
4611 __v, __o);
4612}
4613
4614inline _LIBCPP_INLINE_VISIBILITY
4615unsigned char
4616atomic_fetch_or(volatile atomic_uchar* __obj, unsigned char __v)
4617{
4618 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
4619}
4620
4621inline _LIBCPP_INLINE_VISIBILITY
4622unsigned char
4623atomic_fetch_or(atomic_uchar* __obj, unsigned char __v)
4624{
4625 return atomic_fetch_or(const_cast<volatile atomic_uchar*>(__obj), __v);
4626}
4627
4628inline _LIBCPP_INLINE_VISIBILITY
4629unsigned char
4630atomic_fetch_or_explicit(volatile atomic_uchar* __obj, unsigned char __v,
4631 memory_order __o)
4632{
4633 return __atomic_fetch_or(&__obj->__v_, __v, __o);
4634}
4635
4636inline _LIBCPP_INLINE_VISIBILITY
4637unsigned char
4638atomic_fetch_or_explicit(atomic_uchar* __obj, unsigned char __v,
4639 memory_order __o)
4640{
4641 return atomic_fetch_or_explicit(const_cast<volatile atomic_uchar*>(__obj),
4642 __v, __o);
4643}
4644
4645inline _LIBCPP_INLINE_VISIBILITY
4646unsigned char
4647atomic_fetch_xor(volatile atomic_uchar* __obj, unsigned char __v)
4648{
4649 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
4650}
4651
4652inline _LIBCPP_INLINE_VISIBILITY
4653unsigned char
4654atomic_fetch_xor(atomic_uchar* __obj, unsigned char __v)
4655{
4656 return atomic_fetch_xor(const_cast<volatile atomic_uchar*>(__obj), __v);
4657}
4658
4659inline _LIBCPP_INLINE_VISIBILITY
4660unsigned char
4661atomic_fetch_xor_explicit(volatile atomic_uchar* __obj, unsigned char __v,
4662 memory_order __o)
4663{
4664 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
4665}
4666
4667inline _LIBCPP_INLINE_VISIBILITY
4668unsigned char
4669atomic_fetch_xor_explicit(atomic_uchar* __obj, unsigned char __v,
4670 memory_order __o)
4671{
4672 return atomic_fetch_xor_explicit(const_cast<volatile atomic_uchar*>(__obj),
4673 __v, __o);
4674}
4675
4676// atomic_short
4677
4678struct atomic_short;
4679
4680bool atomic_is_lock_free(const volatile atomic_short*);
4681bool atomic_is_lock_free(const atomic_short*);
4682void atomic_init(volatile atomic_short*, short);
4683void atomic_init(atomic_short*, short);
4684void atomic_store(volatile atomic_short*, short);
4685void atomic_store(atomic_short*, short);
4686void atomic_store_explicit(volatile atomic_short*, short, memory_order);
4687void atomic_store_explicit(atomic_short*, short, memory_order);
4688short atomic_load(const volatile atomic_short*);
4689short atomic_load(const atomic_short*);
4690short atomic_load_explicit(const volatile atomic_short*, memory_order);
4691short atomic_load_explicit(const atomic_short*, memory_order);
4692short atomic_exchange(volatile atomic_short*, short);
4693short atomic_exchange(atomic_short*, short);
4694short atomic_exchange_explicit(volatile atomic_short*, short, memory_order);
4695short atomic_exchange_explicit(atomic_short*, short, memory_order);
4696bool atomic_compare_exchange_weak(volatile atomic_short*, short*, short);
4697bool atomic_compare_exchange_weak(atomic_short*, short*, short);
4698bool atomic_compare_exchange_strong(volatile atomic_short*, short*, short);
4699bool atomic_compare_exchange_strong(atomic_short*, short*, short);
4700bool atomic_compare_exchange_weak_explicit(volatile atomic_short*, short*,
4701 short, memory_order, memory_order);
4702bool atomic_compare_exchange_weak_explicit(atomic_short*, short*, short,
4703 memory_order, memory_order);
4704bool atomic_compare_exchange_strong_explicit(volatile atomic_short*, short*,
4705 short, memory_order, memory_order);
4706bool atomic_compare_exchange_strong_explicit(atomic_short*, short*, short,
4707 memory_order, memory_order);
4708short atomic_fetch_add(volatile atomic_short*, short);
4709short atomic_fetch_add(atomic_short*, short);
4710short atomic_fetch_add_explicit(volatile atomic_short*, short, memory_order);
4711short atomic_fetch_add_explicit(atomic_short*, short, memory_order);
4712short atomic_fetch_sub(volatile atomic_short*, short);
4713short atomic_fetch_sub(atomic_short*, short);
4714short atomic_fetch_sub_explicit(volatile atomic_short*, short, memory_order);
4715short atomic_fetch_sub_explicit(atomic_short*, short, memory_order);
4716short atomic_fetch_and(volatile atomic_short*, short);
4717short atomic_fetch_and(atomic_short*, short);
4718short atomic_fetch_and_explicit(volatile atomic_short*, short, memory_order);
4719short atomic_fetch_and_explicit(atomic_short*, short, memory_order);
4720short atomic_fetch_or(volatile atomic_short*, short);
4721short atomic_fetch_or(atomic_short*, short);
4722short atomic_fetch_or_explicit(volatile atomic_short*, short, memory_order);
4723short atomic_fetch_or_explicit(atomic_short*, short, memory_order);
4724short atomic_fetch_xor(volatile atomic_short*, short);
4725short atomic_fetch_xor(atomic_short*, short);
4726short atomic_fetch_xor_explicit(volatile atomic_short*, short, memory_order);
4727short atomic_fetch_xor_explicit(atomic_short*, short, memory_order);
4728
4729typedef struct atomic_short
4730{
4731 short __v_;
4732
4733 _LIBCPP_INLINE_VISIBILITY
4734 bool is_lock_free() const volatile
4735 {return atomic_is_lock_free(this);}
4736 _LIBCPP_INLINE_VISIBILITY
4737 bool is_lock_free() const
4738 {return atomic_is_lock_free(this);}
4739 _LIBCPP_INLINE_VISIBILITY
4740 void store(short __v, memory_order __o = memory_order_seq_cst) volatile
4741 {atomic_store_explicit(this, __v, __o);}
4742 _LIBCPP_INLINE_VISIBILITY
4743 void store(short __v, memory_order __o = memory_order_seq_cst)
4744 {atomic_store_explicit(this, __v, __o);}
4745 _LIBCPP_INLINE_VISIBILITY
4746 short load(memory_order __o = memory_order_seq_cst) const volatile
4747 {return atomic_load_explicit(this, __o);}
4748 _LIBCPP_INLINE_VISIBILITY
4749 short load(memory_order __o = memory_order_seq_cst) const
4750 {return atomic_load_explicit(this, __o);}
4751 _LIBCPP_INLINE_VISIBILITY
4752 operator short() const volatile
4753 {return load();}
4754 _LIBCPP_INLINE_VISIBILITY
4755 operator short() const
4756 {return load();}
4757 _LIBCPP_INLINE_VISIBILITY
4758 short exchange(short __v, memory_order __o = memory_order_seq_cst) volatile
4759 {return atomic_exchange_explicit(this, __v, __o);}
4760 _LIBCPP_INLINE_VISIBILITY
4761 short exchange(short __v, memory_order __o = memory_order_seq_cst)
4762 {return atomic_exchange_explicit(this, __v, __o);}
4763 _LIBCPP_INLINE_VISIBILITY
4764 bool compare_exchange_weak(short& __v, short __e, memory_order __s,
4765 memory_order __f) volatile
4766 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
4767 __f);}
4768 _LIBCPP_INLINE_VISIBILITY
4769 bool compare_exchange_weak(short& __v, short __e, memory_order __s,
4770 memory_order __f)
4771 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
4772 __f);}
4773 _LIBCPP_INLINE_VISIBILITY
4774 bool compare_exchange_strong(short& __v, short __e, memory_order __s,
4775 memory_order __f) volatile
4776 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
4777 __f);}
4778 _LIBCPP_INLINE_VISIBILITY
4779 bool compare_exchange_strong(short& __v, short __e, memory_order __s,
4780 memory_order __f)
4781 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
4782 __f);}
4783 _LIBCPP_INLINE_VISIBILITY
4784 bool compare_exchange_weak(short& __v, short __e,
4785 memory_order __s = memory_order_seq_cst) volatile
4786 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
4787 __translate_memory_order(__s));}
4788 _LIBCPP_INLINE_VISIBILITY
4789 bool compare_exchange_weak(short& __v, short __e,
4790 memory_order __s = memory_order_seq_cst)
4791 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
4792 __translate_memory_order(__s));}
4793 _LIBCPP_INLINE_VISIBILITY
4794 bool compare_exchange_strong(short& __v, short __e,
4795 memory_order __s = memory_order_seq_cst) volatile
4796 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
4797 __translate_memory_order(__s));}
4798 _LIBCPP_INLINE_VISIBILITY
4799 bool compare_exchange_strong(short& __v, short __e,
4800 memory_order __s = memory_order_seq_cst)
4801 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
4802 __translate_memory_order(__s));}
4803 _LIBCPP_INLINE_VISIBILITY
4804 short fetch_add(short __v, memory_order __o = memory_order_seq_cst) volatile
4805 {return atomic_fetch_add_explicit(this, __v, __o);}
4806 _LIBCPP_INLINE_VISIBILITY
4807 short fetch_add(short __v, memory_order __o = memory_order_seq_cst)
4808 {return atomic_fetch_add_explicit(this, __v, __o);}
4809 _LIBCPP_INLINE_VISIBILITY
4810 short fetch_sub(short __v, memory_order __o = memory_order_seq_cst) volatile
4811 {return atomic_fetch_sub_explicit(this, __v, __o);}
4812 _LIBCPP_INLINE_VISIBILITY
4813 short fetch_sub(short __v, memory_order __o = memory_order_seq_cst)
4814 {return atomic_fetch_sub_explicit(this, __v, __o);}
4815 _LIBCPP_INLINE_VISIBILITY
4816 short fetch_and(short __v, memory_order __o = memory_order_seq_cst) volatile
4817 {return atomic_fetch_and_explicit(this, __v, __o);}
4818 _LIBCPP_INLINE_VISIBILITY
4819 short fetch_and(short __v, memory_order __o = memory_order_seq_cst)
4820 {return atomic_fetch_and_explicit(this, __v, __o);}
4821 _LIBCPP_INLINE_VISIBILITY
4822 short fetch_or(short __v, memory_order __o = memory_order_seq_cst) volatile
4823 {return atomic_fetch_or_explicit(this, __v, __o);}
4824 _LIBCPP_INLINE_VISIBILITY
4825 short fetch_or(short __v, memory_order __o = memory_order_seq_cst)
4826 {return atomic_fetch_or_explicit(this, __v, __o);}
4827 _LIBCPP_INLINE_VISIBILITY
4828 short fetch_xor(short __v, memory_order __o = memory_order_seq_cst) volatile
4829 {return atomic_fetch_xor_explicit(this, __v, __o);}
4830 _LIBCPP_INLINE_VISIBILITY
4831 short fetch_xor(short __v, memory_order __o = memory_order_seq_cst)
4832 {return atomic_fetch_xor_explicit(this, __v, __o);}
4833#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
4834 atomic_short() = default;
4835#else
4836 _LIBCPP_INLINE_VISIBILITY
4837 atomic_short() {}
4838#endif
4839 _LIBCPP_INLINE_VISIBILITY
4840 /*constexpr*/ atomic_short(short __v)
4841 : __v_(__v) {}
4842#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
4843 atomic_short(const atomic_short&) = delete;
4844 atomic_short& operator=(const atomic_short&) = delete;
4845 atomic_short& operator=(const atomic_short&) volatile = delete;
4846#else
4847private:
4848 atomic_short(const atomic_short&);
4849 atomic_short& operator=(const atomic_short&);
4850 atomic_short& operator=(const atomic_short&) volatile;
4851public:
4852#endif
4853 _LIBCPP_INLINE_VISIBILITY
4854 short operator=(short __v) volatile
4855 {store(__v); return __v;}
4856 _LIBCPP_INLINE_VISIBILITY
4857 short operator=(short __v)
4858 {store(__v); return __v;}
4859 _LIBCPP_INLINE_VISIBILITY
4860 short operator++(int) volatile
4861 {return fetch_add(short(1));}
4862 _LIBCPP_INLINE_VISIBILITY
4863 short operator++(int)
4864 {return fetch_add(short(1));}
4865 _LIBCPP_INLINE_VISIBILITY
4866 short operator--(int) volatile
4867 {return fetch_sub(short(1));}
4868 _LIBCPP_INLINE_VISIBILITY
4869 short operator--(int)
4870 {return fetch_sub(short(1));}
4871 _LIBCPP_INLINE_VISIBILITY
4872 short operator++() volatile
4873 {return short(fetch_add(short(1)) + 1);}
4874 _LIBCPP_INLINE_VISIBILITY
4875 short operator++()
4876 {return short(fetch_add(short(1)) + 1);}
4877 _LIBCPP_INLINE_VISIBILITY
4878 short operator--() volatile
4879 {return short(fetch_sub(short(1)) - 1);}
4880 _LIBCPP_INLINE_VISIBILITY
4881 short operator--()
4882 {return short(fetch_sub(short(1)) - 1);}
4883 _LIBCPP_INLINE_VISIBILITY
4884 short operator+=(short __v) volatile
4885 {return short(fetch_add(__v) + __v);}
4886 _LIBCPP_INLINE_VISIBILITY
4887 short operator+=(short __v)
4888 {return short(fetch_add(__v) + __v);}
4889 _LIBCPP_INLINE_VISIBILITY
4890 short operator-=(short __v) volatile
4891 {return short(fetch_sub(__v) - __v);}
4892 _LIBCPP_INLINE_VISIBILITY
4893 short operator-=(short __v)
4894 {return short(fetch_sub(__v) - __v);}
4895 _LIBCPP_INLINE_VISIBILITY
4896 short operator&=(short __v) volatile
4897 {return short(fetch_and(__v) & __v);}
4898 _LIBCPP_INLINE_VISIBILITY
4899 short operator&=(short __v)
4900 {return short(fetch_and(__v) & __v);}
4901 _LIBCPP_INLINE_VISIBILITY
4902 short operator|=(short __v) volatile
4903 {return short(fetch_or(__v) | __v);}
4904 _LIBCPP_INLINE_VISIBILITY
4905 short operator|=(short __v)
4906 {return short(fetch_or(__v) | __v);}
4907 _LIBCPP_INLINE_VISIBILITY
4908 short operator^=(short __v) volatile
4909 {return short(fetch_xor(__v) ^ __v);}
4910 _LIBCPP_INLINE_VISIBILITY
4911 short operator^=(short __v)
4912 {return short(fetch_xor(__v) ^ __v);}
4913} atomic_short;
4914
4915inline _LIBCPP_INLINE_VISIBILITY
4916bool
4917atomic_is_lock_free(const volatile atomic_short*)
4918{
4919 typedef short type;
4920 return __atomic_is_lock_free(type);
4921}
4922
4923inline _LIBCPP_INLINE_VISIBILITY
4924bool
4925atomic_is_lock_free(const atomic_short* __obj)
4926{
4927 return atomic_is_lock_free(const_cast<volatile atomic_short*>(__obj));
4928}
4929
4930inline _LIBCPP_INLINE_VISIBILITY
4931void
4932atomic_init(volatile atomic_short* __obj, short __desr)
4933{
4934 __obj->__v_ = __desr;
4935}
4936
4937inline _LIBCPP_INLINE_VISIBILITY
4938void
4939atomic_init(atomic_short* __obj, short __desr)
4940{
4941 __obj->__v_ = __desr;
4942}
4943
4944inline _LIBCPP_INLINE_VISIBILITY
4945void
4946atomic_store(volatile atomic_short* __obj, short __desr)
4947{
4948 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
4949}
4950
4951inline _LIBCPP_INLINE_VISIBILITY
4952void
4953atomic_store(atomic_short* __obj, short __desr)
4954{
4955 atomic_store(const_cast<volatile atomic_short*>(__obj), __desr);
4956}
4957
4958inline _LIBCPP_INLINE_VISIBILITY
4959void
4960atomic_store_explicit(volatile atomic_short* __obj, short __desr,
4961 memory_order __o)
4962{
4963 __atomic_store(&__obj->__v_, __desr, __o);
4964}
4965
4966inline _LIBCPP_INLINE_VISIBILITY
4967void
4968atomic_store_explicit(atomic_short* __obj, short __desr, memory_order __o)
4969{
4970 atomic_store_explicit(const_cast<volatile atomic_short*>(__obj), __desr,
4971 __o);
4972}
4973
4974inline _LIBCPP_INLINE_VISIBILITY
4975short
4976atomic_load(const volatile atomic_short* __obj)
4977{
4978 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
4979}
4980
4981inline _LIBCPP_INLINE_VISIBILITY
4982short
4983atomic_load(const atomic_short* __obj)
4984{
4985 return atomic_load(const_cast<const volatile atomic_short*>(__obj));
4986}
4987
4988inline _LIBCPP_INLINE_VISIBILITY
4989short
4990atomic_load_explicit(const volatile atomic_short* __obj, memory_order __o)
4991{
4992 return __atomic_load(&__obj->__v_, __o);
4993}
4994
4995inline _LIBCPP_INLINE_VISIBILITY
4996short
4997atomic_load_explicit(const atomic_short* __obj, memory_order __o)
4998{
4999 return atomic_load_explicit(const_cast<const volatile atomic_short*>
5000 (__obj), __o);
5001}
5002
5003inline _LIBCPP_INLINE_VISIBILITY
5004short
5005atomic_exchange(volatile atomic_short* __obj, short __desr)
5006{
5007 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
5008}
5009
5010inline _LIBCPP_INLINE_VISIBILITY
5011short
5012atomic_exchange(atomic_short* __obj, short __desr)
5013{
5014 return atomic_exchange(const_cast<volatile atomic_short*>(__obj), __desr);
5015}
5016
5017inline _LIBCPP_INLINE_VISIBILITY
5018short
5019atomic_exchange_explicit(volatile atomic_short* __obj, short __desr,
5020 memory_order __o)
5021{
5022 return __atomic_exchange(&__obj->__v_, __desr, __o);
5023}
5024
5025inline _LIBCPP_INLINE_VISIBILITY
5026short
5027atomic_exchange_explicit(atomic_short* __obj, short __desr, memory_order __o)
5028{
5029 return atomic_exchange_explicit(const_cast<volatile atomic_short*>
5030 (__obj), __desr, __o);
5031}
5032
5033inline _LIBCPP_INLINE_VISIBILITY
5034bool
5035atomic_compare_exchange_weak(volatile atomic_short* __obj, short* __exp,
5036 short __desr)
5037{
5038 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
5039 memory_order_seq_cst, memory_order_seq_cst);
5040}
5041
5042inline _LIBCPP_INLINE_VISIBILITY
5043bool
5044atomic_compare_exchange_weak(atomic_short* __obj, short* __exp, short __desr)
5045{
5046 return atomic_compare_exchange_weak(const_cast<volatile atomic_short*>
5047 (__obj), __exp, __desr);
5048}
5049
5050inline _LIBCPP_INLINE_VISIBILITY
5051bool
5052atomic_compare_exchange_strong(volatile atomic_short* __obj, short* __exp,
5053 short __desr)
5054{
5055 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
5056 memory_order_seq_cst, memory_order_seq_cst);
5057}
5058
5059inline _LIBCPP_INLINE_VISIBILITY
5060bool
5061atomic_compare_exchange_strong(atomic_short* __obj, short* __exp, short __desr)
5062{
5063 return atomic_compare_exchange_strong(const_cast<volatile atomic_short*>
5064 (__obj), __exp, __desr);
5065}
5066
5067inline _LIBCPP_INLINE_VISIBILITY
5068bool
5069atomic_compare_exchange_weak_explicit(volatile atomic_short* __obj,
5070 short* __exp, short __desr,
5071 memory_order __s, memory_order __f)
5072{
5073 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
5074 __f);
5075}
5076
5077inline _LIBCPP_INLINE_VISIBILITY
5078bool
5079atomic_compare_exchange_weak_explicit(atomic_short* __obj, short* __exp,
5080 short __desr, memory_order __s,
5081 memory_order __f)
5082{
5083 return atomic_compare_exchange_weak_explicit(
5084 const_cast<volatile atomic_short*>(__obj), __exp, __desr, __s, __f);
5085}
5086
5087inline _LIBCPP_INLINE_VISIBILITY
5088bool
5089atomic_compare_exchange_strong_explicit(volatile atomic_short* __obj,
5090 short* __exp, short __desr,
5091 memory_order __s, memory_order __f)
5092{
5093 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
5094 __f);
5095}
5096
5097inline _LIBCPP_INLINE_VISIBILITY
5098bool
5099atomic_compare_exchange_strong_explicit(atomic_short* __obj, short* __exp,
5100 short __desr, memory_order __s,
5101 memory_order __f)
5102{
5103 return atomic_compare_exchange_strong_explicit(
5104 const_cast<volatile atomic_short*>(__obj), __exp, __desr, __s, __f);
5105}
5106
5107inline _LIBCPP_INLINE_VISIBILITY
5108short
5109atomic_fetch_add(volatile atomic_short* __obj, short __v)
5110{
5111 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
5112}
5113
5114inline _LIBCPP_INLINE_VISIBILITY
5115short
5116atomic_fetch_add(atomic_short* __obj, short __v)
5117{
5118 return atomic_fetch_add(const_cast<volatile atomic_short*>(__obj), __v);
5119}
5120
5121inline _LIBCPP_INLINE_VISIBILITY
5122short
5123atomic_fetch_add_explicit(volatile atomic_short* __obj, short __v,
5124 memory_order __o)
5125{
5126 return __atomic_fetch_add(&__obj->__v_, __v, __o);
5127}
5128
5129inline _LIBCPP_INLINE_VISIBILITY
5130short
5131atomic_fetch_add_explicit(atomic_short* __obj, short __v, memory_order __o)
5132{
5133 return atomic_fetch_add_explicit(const_cast<volatile atomic_short*>(__obj),
5134 __v, __o);
5135}
5136
5137inline _LIBCPP_INLINE_VISIBILITY
5138short
5139atomic_fetch_sub(volatile atomic_short* __obj, short __v)
5140{
5141 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
5142}
5143
5144inline _LIBCPP_INLINE_VISIBILITY
5145short
5146atomic_fetch_sub(atomic_short* __obj, short __v)
5147{
5148 return atomic_fetch_sub(const_cast<volatile atomic_short*>(__obj), __v);
5149}
5150
5151inline _LIBCPP_INLINE_VISIBILITY
5152short
5153atomic_fetch_sub_explicit(volatile atomic_short* __obj, short __v,
5154 memory_order __o)
5155{
5156 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
5157}
5158
5159inline _LIBCPP_INLINE_VISIBILITY
5160short
5161atomic_fetch_sub_explicit(atomic_short* __obj, short __v, memory_order __o)
5162{
5163 return atomic_fetch_sub_explicit(const_cast<volatile atomic_short*>(__obj),
5164 __v, __o);
5165}
5166
5167inline _LIBCPP_INLINE_VISIBILITY
5168short
5169atomic_fetch_and(volatile atomic_short* __obj, short __v)
5170{
5171 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
5172}
5173
5174inline _LIBCPP_INLINE_VISIBILITY
5175short
5176atomic_fetch_and(atomic_short* __obj, short __v)
5177{
5178 return atomic_fetch_and(const_cast<volatile atomic_short*>(__obj), __v);
5179}
5180
5181inline _LIBCPP_INLINE_VISIBILITY
5182short
5183atomic_fetch_and_explicit(volatile atomic_short* __obj, short __v,
5184 memory_order __o)
5185{
5186 return __atomic_fetch_and(&__obj->__v_, __v, __o);
5187}
5188
5189inline _LIBCPP_INLINE_VISIBILITY
5190short
5191atomic_fetch_and_explicit(atomic_short* __obj, short __v, memory_order __o)
5192{
5193 return atomic_fetch_and_explicit(const_cast<volatile atomic_short*>(__obj),
5194 __v, __o);
5195}
5196
5197inline _LIBCPP_INLINE_VISIBILITY
5198short
5199atomic_fetch_or(volatile atomic_short* __obj, short __v)
5200{
5201 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
5202}
5203
5204inline _LIBCPP_INLINE_VISIBILITY
5205short
5206atomic_fetch_or(atomic_short* __obj, short __v)
5207{
5208 return atomic_fetch_or(const_cast<volatile atomic_short*>(__obj), __v);
5209}
5210
5211inline _LIBCPP_INLINE_VISIBILITY
5212short
5213atomic_fetch_or_explicit(volatile atomic_short* __obj, short __v,
5214 memory_order __o)
5215{
5216 return __atomic_fetch_or(&__obj->__v_, __v, __o);
5217}
5218
5219inline _LIBCPP_INLINE_VISIBILITY
5220short
5221atomic_fetch_or_explicit(atomic_short* __obj, short __v, memory_order __o)
5222{
5223 return atomic_fetch_or_explicit(const_cast<volatile atomic_short*>(__obj),
5224 __v, __o);
5225}
5226
5227inline _LIBCPP_INLINE_VISIBILITY
5228short
5229atomic_fetch_xor(volatile atomic_short* __obj, short __v)
5230{
5231 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
5232}
5233
5234inline _LIBCPP_INLINE_VISIBILITY
5235short
5236atomic_fetch_xor(atomic_short* __obj, short __v)
5237{
5238 return atomic_fetch_xor(const_cast<volatile atomic_short*>(__obj), __v);
5239}
5240
5241inline _LIBCPP_INLINE_VISIBILITY
5242short
5243atomic_fetch_xor_explicit(volatile atomic_short* __obj, short __v,
5244 memory_order __o)
5245{
5246 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
5247}
5248
5249inline _LIBCPP_INLINE_VISIBILITY
5250short
5251atomic_fetch_xor_explicit(atomic_short* __obj, short __v, memory_order __o)
5252{
5253 return atomic_fetch_xor_explicit(const_cast<volatile atomic_short*>(__obj),
5254 __v, __o);
5255}
5256
5257// atomic_ushort
5258
5259struct atomic_ushort;
5260
5261bool atomic_is_lock_free(const volatile atomic_ushort*);
5262bool atomic_is_lock_free(const atomic_ushort*);
5263void atomic_init(volatile atomic_ushort*, unsigned short);
5264void atomic_init(atomic_ushort*, unsigned short);
5265void atomic_store(volatile atomic_ushort*, unsigned short);
5266void atomic_store(atomic_ushort*, unsigned short);
5267void atomic_store_explicit(volatile atomic_ushort*, unsigned short,
5268 memory_order);
5269void atomic_store_explicit(atomic_ushort*, unsigned short, memory_order);
5270unsigned short atomic_load(const volatile atomic_ushort*);
5271unsigned short atomic_load(const atomic_ushort*);
5272unsigned short atomic_load_explicit(const volatile atomic_ushort*,
5273 memory_order);
5274unsigned short atomic_load_explicit(const atomic_ushort*, memory_order);
5275unsigned short atomic_exchange(volatile atomic_ushort*, unsigned short);
5276unsigned short atomic_exchange(atomic_ushort*, unsigned short);
5277unsigned short atomic_exchange_explicit(volatile atomic_ushort*, unsigned short,
5278 memory_order);
5279unsigned short atomic_exchange_explicit(atomic_ushort*, unsigned short,
5280 memory_order);
5281bool atomic_compare_exchange_weak(volatile atomic_ushort*, unsigned short*,
5282 unsigned short);
5283bool atomic_compare_exchange_weak(atomic_ushort*, unsigned short*,
5284 unsigned short);
5285bool atomic_compare_exchange_strong(volatile atomic_ushort*, unsigned short*,
5286 unsigned short);
5287bool atomic_compare_exchange_strong(atomic_ushort*, unsigned short*,
5288 unsigned short);
5289bool atomic_compare_exchange_weak_explicit(volatile atomic_ushort*,
5290 unsigned short*, unsigned short,
5291 memory_order, memory_order);
5292bool atomic_compare_exchange_weak_explicit(atomic_ushort*, unsigned short*,
5293 unsigned short, memory_order,
5294 memory_order);
5295bool atomic_compare_exchange_strong_explicit(volatile atomic_ushort*,
5296 unsigned short*, unsigned short,
5297 memory_order, memory_order);
5298bool atomic_compare_exchange_strong_explicit(atomic_ushort*, unsigned short*,
5299 unsigned short, memory_order,
5300 memory_order);
5301unsigned short atomic_fetch_add(volatile atomic_ushort*, unsigned short);
5302unsigned short atomic_fetch_add(atomic_ushort*, unsigned short);
5303unsigned short atomic_fetch_add_explicit(volatile atomic_ushort*,
5304 unsigned short, memory_order);
5305unsigned short atomic_fetch_add_explicit(atomic_ushort*, unsigned short,
5306 memory_order);
5307unsigned short atomic_fetch_sub(volatile atomic_ushort*, unsigned short);
5308unsigned short atomic_fetch_sub(atomic_ushort*, unsigned short);
5309unsigned short atomic_fetch_sub_explicit(volatile atomic_ushort*,
5310 unsigned short, memory_order);
5311unsigned short atomic_fetch_sub_explicit(atomic_ushort*, unsigned short,
5312 memory_order);
5313unsigned short atomic_fetch_and(volatile atomic_ushort*, unsigned short);
5314unsigned short atomic_fetch_and(atomic_ushort*, unsigned short);
5315unsigned short atomic_fetch_and_explicit(volatile atomic_ushort*,
5316 unsigned short, memory_order);
5317unsigned short atomic_fetch_and_explicit(atomic_ushort*, unsigned short,
5318 memory_order);
5319unsigned short atomic_fetch_or(volatile atomic_ushort*, unsigned short);
5320unsigned short atomic_fetch_or(atomic_ushort*, unsigned short);
5321unsigned short atomic_fetch_or_explicit(volatile atomic_ushort*, unsigned short,
5322 memory_order);
5323unsigned short atomic_fetch_or_explicit(atomic_ushort*, unsigned short,
5324 memory_order);
5325unsigned short atomic_fetch_xor(volatile atomic_ushort*, unsigned short);
5326unsigned short atomic_fetch_xor(atomic_ushort*, unsigned short);
5327unsigned short atomic_fetch_xor_explicit(volatile atomic_ushort*,
5328 unsigned short, memory_order);
5329unsigned short atomic_fetch_xor_explicit(atomic_ushort*, unsigned short,
5330 memory_order);
5331
5332typedef struct atomic_ushort
5333{
5334 unsigned short __v_;
5335
5336 _LIBCPP_INLINE_VISIBILITY
5337 bool is_lock_free() const volatile
5338 {return atomic_is_lock_free(this);}
5339 _LIBCPP_INLINE_VISIBILITY
5340 bool is_lock_free() const
5341 {return atomic_is_lock_free(this);}
5342 _LIBCPP_INLINE_VISIBILITY
5343 void store(unsigned short __v,
5344 memory_order __o = memory_order_seq_cst) volatile
5345 {atomic_store_explicit(this, __v, __o);}
5346 _LIBCPP_INLINE_VISIBILITY
5347 void store(unsigned short __v, memory_order __o = memory_order_seq_cst)
5348 {atomic_store_explicit(this, __v, __o);}
5349 _LIBCPP_INLINE_VISIBILITY
5350 unsigned short load(memory_order __o = memory_order_seq_cst) const volatile
5351 {return atomic_load_explicit(this, __o);}
5352 _LIBCPP_INLINE_VISIBILITY
5353 unsigned short load(memory_order __o = memory_order_seq_cst) const
5354 {return atomic_load_explicit(this, __o);}
5355 _LIBCPP_INLINE_VISIBILITY
5356 operator unsigned short() const volatile
5357 {return load();}
5358 _LIBCPP_INLINE_VISIBILITY
5359 operator unsigned short() const
5360 {return load();}
5361 _LIBCPP_INLINE_VISIBILITY
5362 unsigned short exchange(unsigned short __v,
5363 memory_order __o = memory_order_seq_cst) volatile
5364 {return atomic_exchange_explicit(this, __v, __o);}
5365 _LIBCPP_INLINE_VISIBILITY
5366 unsigned short exchange(unsigned short __v,
5367 memory_order __o = memory_order_seq_cst)
5368 {return atomic_exchange_explicit(this, __v, __o);}
5369 _LIBCPP_INLINE_VISIBILITY
5370 bool compare_exchange_weak(unsigned short& __v, unsigned short __e,
5371 memory_order __s, memory_order __f) volatile
5372 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
5373 __f);}
5374 _LIBCPP_INLINE_VISIBILITY
5375 bool compare_exchange_weak(unsigned short& __v, unsigned short __e,
5376 memory_order __s, memory_order __f)
5377 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
5378 __f);}
5379 _LIBCPP_INLINE_VISIBILITY
5380 bool compare_exchange_strong(unsigned short& __v, unsigned short __e,
5381 memory_order __s, memory_order __f) volatile
5382 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
5383 __f);}
5384 _LIBCPP_INLINE_VISIBILITY
5385 bool compare_exchange_strong(unsigned short& __v, unsigned short __e,
5386 memory_order __s, memory_order __f)
5387 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
5388 __f);}
5389 _LIBCPP_INLINE_VISIBILITY
5390 bool compare_exchange_weak(unsigned short& __v, unsigned short __e,
5391 memory_order __s = memory_order_seq_cst) volatile
5392 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
5393 __translate_memory_order(__s));}
5394 _LIBCPP_INLINE_VISIBILITY
5395 bool compare_exchange_weak(unsigned short& __v, unsigned short __e,
5396 memory_order __s = memory_order_seq_cst)
5397 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
5398 __translate_memory_order(__s));}
5399 _LIBCPP_INLINE_VISIBILITY
5400 bool compare_exchange_strong(unsigned short& __v, unsigned short __e,
5401 memory_order __s = memory_order_seq_cst) volatile
5402 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
5403 __translate_memory_order(__s));}
5404 _LIBCPP_INLINE_VISIBILITY
5405 bool compare_exchange_strong(unsigned short& __v, unsigned short __e,
5406 memory_order __s = memory_order_seq_cst)
5407 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
5408 __translate_memory_order(__s));}
5409 _LIBCPP_INLINE_VISIBILITY
5410 unsigned short fetch_add(unsigned short __v,
5411 memory_order __o = memory_order_seq_cst) volatile
5412 {return atomic_fetch_add_explicit(this, __v, __o);}
5413 _LIBCPP_INLINE_VISIBILITY
5414 unsigned short fetch_add(unsigned short __v,
5415 memory_order __o = memory_order_seq_cst)
5416 {return atomic_fetch_add_explicit(this, __v, __o);}
5417 _LIBCPP_INLINE_VISIBILITY
5418 unsigned short fetch_sub(unsigned short __v,
5419 memory_order __o = memory_order_seq_cst) volatile
5420 {return atomic_fetch_sub_explicit(this, __v, __o);}
5421 _LIBCPP_INLINE_VISIBILITY
5422 unsigned short fetch_sub(unsigned short __v,
5423 memory_order __o = memory_order_seq_cst)
5424 {return atomic_fetch_sub_explicit(this, __v, __o);}
5425 _LIBCPP_INLINE_VISIBILITY
5426 unsigned short fetch_and(unsigned short __v,
5427 memory_order __o = memory_order_seq_cst) volatile
5428 {return atomic_fetch_and_explicit(this, __v, __o);}
5429 _LIBCPP_INLINE_VISIBILITY
5430 unsigned short fetch_and(unsigned short __v,
5431 memory_order __o = memory_order_seq_cst)
5432 {return atomic_fetch_and_explicit(this, __v, __o);}
5433 _LIBCPP_INLINE_VISIBILITY
5434 unsigned short fetch_or(unsigned short __v,
5435 memory_order __o = memory_order_seq_cst) volatile
5436 {return atomic_fetch_or_explicit(this, __v, __o);}
5437 _LIBCPP_INLINE_VISIBILITY
5438 unsigned short fetch_or(unsigned short __v,
5439 memory_order __o = memory_order_seq_cst)
5440 {return atomic_fetch_or_explicit(this, __v, __o);}
5441 _LIBCPP_INLINE_VISIBILITY
5442 unsigned short fetch_xor(unsigned short __v,
5443 memory_order __o = memory_order_seq_cst) volatile
5444 {return atomic_fetch_xor_explicit(this, __v, __o);}
5445 _LIBCPP_INLINE_VISIBILITY
5446 unsigned short fetch_xor(unsigned short __v,
5447 memory_order __o = memory_order_seq_cst)
5448 {return atomic_fetch_xor_explicit(this, __v, __o);}
5449#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
5450 atomic_ushort() = default;
5451#else
5452 _LIBCPP_INLINE_VISIBILITY
5453 atomic_ushort() {}
5454#endif
5455 _LIBCPP_INLINE_VISIBILITY
5456 /*constexpr*/ atomic_ushort(unsigned short __v)
5457 : __v_(__v) {}
5458#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
5459 atomic_ushort(const atomic_ushort&) = delete;
5460 atomic_ushort& operator=(const atomic_ushort&) = delete;
5461 atomic_ushort& operator=(const atomic_ushort&) volatile = delete;
5462#else
5463private:
5464 atomic_ushort(const atomic_ushort&);
5465 atomic_ushort& operator=(const atomic_ushort&);
5466 atomic_ushort& operator=(const atomic_ushort&) volatile;
5467public:
5468#endif
5469 _LIBCPP_INLINE_VISIBILITY
5470 unsigned short operator=(unsigned short __v) volatile
5471 {store(__v); return __v;}
5472 _LIBCPP_INLINE_VISIBILITY
5473 unsigned short operator=(unsigned short __v)
5474 {store(__v); return __v;}
5475 _LIBCPP_INLINE_VISIBILITY
5476 unsigned short operator++(int) volatile
5477 {typedef unsigned short type; return fetch_add(type(1));}
5478 _LIBCPP_INLINE_VISIBILITY
5479 short operator++(int)
5480 {typedef unsigned short type; return fetch_add(type(1));}
5481 _LIBCPP_INLINE_VISIBILITY
5482 short operator--(int) volatile
5483 {typedef unsigned short type; return fetch_sub(type(1));}
5484 _LIBCPP_INLINE_VISIBILITY
5485 short operator--(int)
5486 {typedef unsigned short type; return fetch_sub(type(1));}
5487 _LIBCPP_INLINE_VISIBILITY
5488 short operator++() volatile
5489 {typedef unsigned short type; return type(fetch_add(type(1)) + 1);}
5490 _LIBCPP_INLINE_VISIBILITY
5491 short operator++()
5492 {typedef unsigned short type; return type(fetch_add(type(1)) + 1);}
5493 _LIBCPP_INLINE_VISIBILITY
5494 short operator--() volatile
5495 {typedef unsigned short type; return type(fetch_sub(type(1)) - 1);}
5496 _LIBCPP_INLINE_VISIBILITY
5497 short operator--()
5498 {typedef unsigned short type; return type(fetch_sub(type(1)) - 1);}
5499 _LIBCPP_INLINE_VISIBILITY
5500 short operator+=(short __v) volatile
5501 {typedef unsigned short type; return type(fetch_add(__v) + __v);}
5502 _LIBCPP_INLINE_VISIBILITY
5503 short operator+=(short __v)
5504 {typedef unsigned short type; return type(fetch_add(__v) + __v);}
5505 _LIBCPP_INLINE_VISIBILITY
5506 short operator-=(short __v) volatile
5507 {typedef unsigned short type; return type(fetch_sub(__v) - __v);}
5508 _LIBCPP_INLINE_VISIBILITY
5509 short operator-=(short __v)
5510 {typedef unsigned short type; return type(fetch_sub(__v) - __v);}
5511 _LIBCPP_INLINE_VISIBILITY
5512 short operator&=(short __v) volatile
5513 {typedef unsigned short type; return type(fetch_and(__v) & __v);}
5514 _LIBCPP_INLINE_VISIBILITY
5515 short operator&=(short __v)
5516 {typedef unsigned short type; return type(fetch_and(__v) & __v);}
5517 _LIBCPP_INLINE_VISIBILITY
5518 short operator|=(short __v) volatile
5519 {typedef unsigned short type; return type(fetch_or(__v) | __v);}
5520 _LIBCPP_INLINE_VISIBILITY
5521 short operator|=(short __v)
5522 {typedef unsigned short type; return type(fetch_or(__v) | __v);}
5523 _LIBCPP_INLINE_VISIBILITY
5524 short operator^=(short __v) volatile
5525 {typedef unsigned short type; return type(fetch_xor(__v) ^ __v);}
5526 _LIBCPP_INLINE_VISIBILITY
5527 short operator^=(short __v)
5528 {typedef unsigned short type; return type(fetch_xor(__v) ^ __v);}
5529} atomic_ushort;
5530
5531inline _LIBCPP_INLINE_VISIBILITY
5532bool
5533atomic_is_lock_free(const volatile atomic_ushort*)
5534{
5535 typedef unsigned short type;
5536 return __atomic_is_lock_free(type);
5537}
5538
5539inline _LIBCPP_INLINE_VISIBILITY
5540bool
5541atomic_is_lock_free(const atomic_ushort* __obj)
5542{
5543 return atomic_is_lock_free(const_cast<volatile atomic_ushort*>(__obj));
5544}
5545
5546inline _LIBCPP_INLINE_VISIBILITY
5547void
5548atomic_init(volatile atomic_ushort* __obj, unsigned short __desr)
5549{
5550 __obj->__v_ = __desr;
5551}
5552
5553inline _LIBCPP_INLINE_VISIBILITY
5554void
5555atomic_init(atomic_ushort* __obj, unsigned short __desr)
5556{
5557 __obj->__v_ = __desr;
5558}
5559
5560inline _LIBCPP_INLINE_VISIBILITY
5561void
5562atomic_store(volatile atomic_ushort* __obj, unsigned short __desr)
5563{
5564 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
5565}
5566
5567inline _LIBCPP_INLINE_VISIBILITY
5568void
5569atomic_store(atomic_ushort* __obj, unsigned short __desr)
5570{
5571 atomic_store(const_cast<volatile atomic_ushort*>(__obj), __desr);
5572}
5573
5574inline _LIBCPP_INLINE_VISIBILITY
5575void
5576atomic_store_explicit(volatile atomic_ushort* __obj, unsigned short __desr,
5577 memory_order __o)
5578{
5579 __atomic_store(&__obj->__v_, __desr, __o);
5580}
5581
5582inline _LIBCPP_INLINE_VISIBILITY
5583void
5584atomic_store_explicit(atomic_ushort* __obj, unsigned short __desr,
5585 memory_order __o)
5586{
5587 atomic_store_explicit(const_cast<volatile atomic_ushort*>(__obj), __desr,
5588 __o);
5589}
5590
5591inline _LIBCPP_INLINE_VISIBILITY
5592unsigned short
5593atomic_load(const volatile atomic_ushort* __obj)
5594{
5595 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
5596}
5597
5598inline _LIBCPP_INLINE_VISIBILITY
5599unsigned short
5600atomic_load(const atomic_ushort* __obj)
5601{
5602 return atomic_load(const_cast<const volatile atomic_ushort*>(__obj));
5603}
5604
5605inline _LIBCPP_INLINE_VISIBILITY
5606unsigned short
5607atomic_load_explicit(const volatile atomic_ushort* __obj, memory_order __o)
5608{
5609 return __atomic_load(&__obj->__v_, __o);
5610}
5611
5612inline _LIBCPP_INLINE_VISIBILITY
5613unsigned short
5614atomic_load_explicit(const atomic_ushort* __obj, memory_order __o)
5615{
5616 return atomic_load_explicit(const_cast<const volatile atomic_ushort*>
5617 (__obj), __o);
5618}
5619
5620inline _LIBCPP_INLINE_VISIBILITY
5621unsigned short
5622atomic_exchange(volatile atomic_ushort* __obj, unsigned short __desr)
5623{
5624 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
5625}
5626
5627inline _LIBCPP_INLINE_VISIBILITY
5628unsigned short
5629atomic_exchange(atomic_ushort* __obj, unsigned short __desr)
5630{
5631 return atomic_exchange(const_cast<volatile atomic_ushort*>(__obj), __desr);
5632}
5633
5634inline _LIBCPP_INLINE_VISIBILITY
5635unsigned short
5636atomic_exchange_explicit(volatile atomic_ushort* __obj, unsigned short __desr,
5637 memory_order __o)
5638{
5639 return __atomic_exchange(&__obj->__v_, __desr, __o);
5640}
5641
5642inline _LIBCPP_INLINE_VISIBILITY
5643unsigned short
5644atomic_exchange_explicit(atomic_ushort* __obj, unsigned short __desr,
5645 memory_order __o)
5646{
5647 return atomic_exchange_explicit(const_cast<volatile atomic_ushort*>
5648 (__obj), __desr, __o);
5649}
5650
5651inline _LIBCPP_INLINE_VISIBILITY
5652bool
5653atomic_compare_exchange_weak(volatile atomic_ushort* __obj,
5654 unsigned short* __exp, unsigned short __desr)
5655{
5656 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
5657 memory_order_seq_cst, memory_order_seq_cst);
5658}
5659
5660inline _LIBCPP_INLINE_VISIBILITY
5661bool
5662atomic_compare_exchange_weak(atomic_ushort* __obj, unsigned short* __exp,
5663 unsigned short __desr)
5664{
5665 return atomic_compare_exchange_weak(const_cast<volatile atomic_ushort*>
5666 (__obj), __exp, __desr);
5667}
5668
5669inline _LIBCPP_INLINE_VISIBILITY
5670bool
5671atomic_compare_exchange_strong(volatile atomic_ushort* __obj,
5672 unsigned short* __exp, unsigned short __desr)
5673{
5674 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
5675 memory_order_seq_cst, memory_order_seq_cst);
5676}
5677
5678inline _LIBCPP_INLINE_VISIBILITY
5679bool
5680atomic_compare_exchange_strong(atomic_ushort* __obj, unsigned short* __exp,
5681 unsigned short __desr)
5682{
5683 return atomic_compare_exchange_strong(const_cast<volatile atomic_ushort*>
5684 (__obj), __exp, __desr);
5685}
5686
5687inline _LIBCPP_INLINE_VISIBILITY
5688bool
5689atomic_compare_exchange_weak_explicit(volatile atomic_ushort* __obj,
5690 unsigned short* __exp,
5691 unsigned short __desr, memory_order __s,
5692 memory_order __f)
5693{
5694 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
5695 __f);
5696}
5697
5698inline _LIBCPP_INLINE_VISIBILITY
5699bool
5700atomic_compare_exchange_weak_explicit(atomic_ushort* __obj,
5701 unsigned short* __exp,
5702 unsigned short __desr, memory_order __s,
5703 memory_order __f)
5704{
5705 return atomic_compare_exchange_weak_explicit(
5706 const_cast<volatile atomic_ushort*>(__obj), __exp, __desr, __s, __f);
5707}
5708
5709inline _LIBCPP_INLINE_VISIBILITY
5710bool
5711atomic_compare_exchange_strong_explicit(volatile atomic_ushort* __obj,
5712 unsigned short* __exp,
5713 unsigned short __desr, memory_order __s,
5714 memory_order __f)
5715{
5716 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
5717 __f);
5718}
5719
5720inline _LIBCPP_INLINE_VISIBILITY
5721bool
5722atomic_compare_exchange_strong_explicit(atomic_ushort* __obj,
5723 unsigned short* __exp,
5724 unsigned short __desr, memory_order __s,
5725 memory_order __f)
5726{
5727 return atomic_compare_exchange_strong_explicit(
5728 const_cast<volatile atomic_ushort*>(__obj), __exp, __desr, __s, __f);
5729}
5730
5731inline _LIBCPP_INLINE_VISIBILITY
5732unsigned short
5733atomic_fetch_add(volatile atomic_ushort* __obj, unsigned short __v)
5734{
5735 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
5736}
5737
5738inline _LIBCPP_INLINE_VISIBILITY
5739unsigned short
5740atomic_fetch_add(atomic_ushort* __obj, unsigned short __v)
5741{
5742 return atomic_fetch_add(const_cast<volatile atomic_ushort*>(__obj), __v);
5743}
5744
5745inline _LIBCPP_INLINE_VISIBILITY
5746unsigned short
5747atomic_fetch_add_explicit(volatile atomic_ushort* __obj, unsigned short __v,
5748 memory_order __o)
5749{
5750 return __atomic_fetch_add(&__obj->__v_, __v, __o);
5751}
5752
5753inline _LIBCPP_INLINE_VISIBILITY
5754unsigned short
5755atomic_fetch_add_explicit(atomic_ushort* __obj, unsigned short __v,
5756 memory_order __o)
5757{
5758 return atomic_fetch_add_explicit(const_cast<volatile atomic_ushort*>(__obj),
5759 __v, __o);
5760}
5761
5762inline _LIBCPP_INLINE_VISIBILITY
5763unsigned short
5764atomic_fetch_sub(volatile atomic_ushort* __obj, unsigned short __v)
5765{
5766 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
5767}
5768
5769inline _LIBCPP_INLINE_VISIBILITY
5770unsigned short
5771atomic_fetch_sub(atomic_ushort* __obj, unsigned short __v)
5772{
5773 return atomic_fetch_sub(const_cast<volatile atomic_ushort*>(__obj), __v);
5774}
5775
5776inline _LIBCPP_INLINE_VISIBILITY
5777unsigned short
5778atomic_fetch_sub_explicit(volatile atomic_ushort* __obj, unsigned short __v,
5779 memory_order __o)
5780{
5781 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
5782}
5783
5784inline _LIBCPP_INLINE_VISIBILITY
5785unsigned short
5786atomic_fetch_sub_explicit(atomic_ushort* __obj, unsigned short __v,
5787 memory_order __o)
5788{
5789 return atomic_fetch_sub_explicit(const_cast<volatile atomic_ushort*>(__obj),
5790 __v, __o);
5791}
5792
5793inline _LIBCPP_INLINE_VISIBILITY
5794unsigned short
5795atomic_fetch_and(volatile atomic_ushort* __obj, unsigned short __v)
5796{
5797 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
5798}
5799
5800inline _LIBCPP_INLINE_VISIBILITY
5801unsigned short
5802atomic_fetch_and(atomic_ushort* __obj, unsigned short __v)
5803{
5804 return atomic_fetch_and(const_cast<volatile atomic_ushort*>(__obj), __v);
5805}
5806
5807inline _LIBCPP_INLINE_VISIBILITY
5808unsigned short
5809atomic_fetch_and_explicit(volatile atomic_ushort* __obj, unsigned short __v,
5810 memory_order __o)
5811{
5812 return __atomic_fetch_and(&__obj->__v_, __v, __o);
5813}
5814
5815inline _LIBCPP_INLINE_VISIBILITY
5816unsigned short
5817atomic_fetch_and_explicit(atomic_ushort* __obj, unsigned short __v,
5818 memory_order __o)
5819{
5820 return atomic_fetch_and_explicit(const_cast<volatile atomic_ushort*>(__obj),
5821 __v, __o);
5822}
5823
5824inline _LIBCPP_INLINE_VISIBILITY
5825unsigned short
5826atomic_fetch_or(volatile atomic_ushort* __obj, unsigned short __v)
5827{
5828 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
5829}
5830
5831inline _LIBCPP_INLINE_VISIBILITY
5832unsigned short
5833atomic_fetch_or(atomic_ushort* __obj, unsigned short __v)
5834{
5835 return atomic_fetch_or(const_cast<volatile atomic_ushort*>(__obj), __v);
5836}
5837
5838inline _LIBCPP_INLINE_VISIBILITY
5839unsigned short
5840atomic_fetch_or_explicit(volatile atomic_ushort* __obj, unsigned short __v,
5841 memory_order __o)
5842{
5843 return __atomic_fetch_or(&__obj->__v_, __v, __o);
5844}
5845
5846inline _LIBCPP_INLINE_VISIBILITY
5847unsigned short
5848atomic_fetch_or_explicit(atomic_ushort* __obj, unsigned short __v,
5849 memory_order __o)
5850{
5851 return atomic_fetch_or_explicit(const_cast<volatile atomic_ushort*>(__obj),
5852 __v, __o);
5853}
5854
5855inline _LIBCPP_INLINE_VISIBILITY
5856unsigned short
5857atomic_fetch_xor(volatile atomic_ushort* __obj, unsigned short __v)
5858{
5859 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
5860}
5861
5862inline _LIBCPP_INLINE_VISIBILITY
5863unsigned short
5864atomic_fetch_xor(atomic_ushort* __obj, unsigned short __v)
5865{
5866 return atomic_fetch_xor(const_cast<volatile atomic_ushort*>(__obj), __v);
5867}
5868
5869inline _LIBCPP_INLINE_VISIBILITY
5870unsigned short
5871atomic_fetch_xor_explicit(volatile atomic_ushort* __obj, unsigned short __v,
5872 memory_order __o)
5873{
5874 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
5875}
5876
5877inline _LIBCPP_INLINE_VISIBILITY
5878unsigned short
5879atomic_fetch_xor_explicit(atomic_ushort* __obj, unsigned short __v,
5880 memory_order __o)
5881{
5882 return atomic_fetch_xor_explicit(const_cast<volatile atomic_ushort*>(__obj),
5883 __v, __o);
5884}
5885
5886// atomic_int
5887
5888struct atomic_int;
5889
5890bool atomic_is_lock_free(const volatile atomic_int*);
5891bool atomic_is_lock_free(const atomic_int*);
5892void atomic_init(volatile atomic_int*, int);
5893void atomic_init(atomic_int*, int);
5894void atomic_store(volatile atomic_int*, int);
5895void atomic_store(atomic_int*, int);
5896void atomic_store_explicit(volatile atomic_int*, int, memory_order);
5897void atomic_store_explicit(atomic_int*, int, memory_order);
5898int atomic_load(const volatile atomic_int*);
5899int atomic_load(const atomic_int*);
5900int atomic_load_explicit(const volatile atomic_int*, memory_order);
5901int atomic_load_explicit(const atomic_int*, memory_order);
5902int atomic_exchange(volatile atomic_int*, int);
5903int atomic_exchange(atomic_int*, int);
5904int atomic_exchange_explicit(volatile atomic_int*, int, memory_order);
5905int atomic_exchange_explicit(atomic_int*, int, memory_order);
5906bool atomic_compare_exchange_weak(volatile atomic_int*, int*, int);
5907bool atomic_compare_exchange_weak(atomic_int*, int*, int);
5908bool atomic_compare_exchange_strong(volatile atomic_int*, int*, int);
5909bool atomic_compare_exchange_strong(atomic_int*, int*, int);
5910bool atomic_compare_exchange_weak_explicit(volatile atomic_int*, int*, int,
5911 memory_order, memory_order);
5912bool atomic_compare_exchange_weak_explicit(atomic_int*, int*, int,
5913 memory_order, memory_order);
5914bool atomic_compare_exchange_strong_explicit(volatile atomic_int*, int*, int,
5915 memory_order, memory_order);
5916bool atomic_compare_exchange_strong_explicit(atomic_int*, int*, int,
5917 memory_order, memory_order);
5918int atomic_fetch_add(volatile atomic_int*, int);
5919int atomic_fetch_add(atomic_int*, int);
5920int atomic_fetch_add_explicit(volatile atomic_int*, int, memory_order);
5921int atomic_fetch_add_explicit(atomic_int*, int, memory_order);
5922int atomic_fetch_sub(volatile atomic_int*, int);
5923int atomic_fetch_sub(atomic_int*, int);
5924int atomic_fetch_sub_explicit(volatile atomic_int*, int, memory_order);
5925int atomic_fetch_sub_explicit(atomic_int*, int, memory_order);
5926int atomic_fetch_and(volatile atomic_int*, int);
5927int atomic_fetch_and(atomic_int*, int);
5928int atomic_fetch_and_explicit(volatile atomic_int*, int, memory_order);
5929int atomic_fetch_and_explicit(atomic_int*, int, memory_order);
5930int atomic_fetch_or(volatile atomic_int*, int);
5931int atomic_fetch_or(atomic_int*, int);
5932int atomic_fetch_or_explicit(volatile atomic_int*, int, memory_order);
5933int atomic_fetch_or_explicit(atomic_int*, int, memory_order);
5934int atomic_fetch_xor(volatile atomic_int*, int);
5935int atomic_fetch_xor(atomic_int*, int);
5936int atomic_fetch_xor_explicit(volatile atomic_int*, int, memory_order);
5937int atomic_fetch_xor_explicit(atomic_int*, int, memory_order);
5938
5939typedef struct atomic_int
5940{
5941 int __v_;
5942
5943 _LIBCPP_INLINE_VISIBILITY
5944 bool is_lock_free() const volatile
5945 {return atomic_is_lock_free(this);}
5946 _LIBCPP_INLINE_VISIBILITY
5947 bool is_lock_free() const
5948 {return atomic_is_lock_free(this);}
5949 _LIBCPP_INLINE_VISIBILITY
5950 void store(int __v, memory_order __o = memory_order_seq_cst) volatile
5951 {atomic_store_explicit(this, __v, __o);}
5952 _LIBCPP_INLINE_VISIBILITY
5953 void store(int __v, memory_order __o = memory_order_seq_cst)
5954 {atomic_store_explicit(this, __v, __o);}
5955 _LIBCPP_INLINE_VISIBILITY
5956 int load(memory_order __o = memory_order_seq_cst) const volatile
5957 {return atomic_load_explicit(this, __o);}
5958 _LIBCPP_INLINE_VISIBILITY
5959 int load(memory_order __o = memory_order_seq_cst) const
5960 {return atomic_load_explicit(this, __o);}
5961 _LIBCPP_INLINE_VISIBILITY
5962 operator int() const volatile
5963 {return load();}
5964 _LIBCPP_INLINE_VISIBILITY
5965 operator int() const
5966 {return load();}
5967 _LIBCPP_INLINE_VISIBILITY
5968 int exchange(int __v, memory_order __o = memory_order_seq_cst) volatile
5969 {return atomic_exchange_explicit(this, __v, __o);}
5970 _LIBCPP_INLINE_VISIBILITY
5971 int exchange(int __v, memory_order __o = memory_order_seq_cst)
5972 {return atomic_exchange_explicit(this, __v, __o);}
5973 _LIBCPP_INLINE_VISIBILITY
5974 bool compare_exchange_weak(int& __v, int __e, memory_order __s,
5975 memory_order __f) volatile
5976 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
5977 __f);}
5978 _LIBCPP_INLINE_VISIBILITY
5979 bool compare_exchange_weak(int& __v, int __e, memory_order __s,
5980 memory_order __f)
5981 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
5982 __f);}
5983 _LIBCPP_INLINE_VISIBILITY
5984 bool compare_exchange_strong(int& __v, int __e, memory_order __s,
5985 memory_order __f) volatile
5986 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
5987 __f);}
5988 _LIBCPP_INLINE_VISIBILITY
5989 bool compare_exchange_strong(int& __v, int __e, memory_order __s,
5990 memory_order __f)
5991 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
5992 __f);}
5993 _LIBCPP_INLINE_VISIBILITY
5994 bool compare_exchange_weak(int& __v, int __e,
5995 memory_order __s = memory_order_seq_cst) volatile
5996 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
5997 __translate_memory_order(__s));}
5998 _LIBCPP_INLINE_VISIBILITY
5999 bool compare_exchange_weak(int& __v, int __e,
6000 memory_order __s = memory_order_seq_cst)
6001 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
6002 __translate_memory_order(__s));}
6003 _LIBCPP_INLINE_VISIBILITY
6004 bool compare_exchange_strong(int& __v, int __e,
6005 memory_order __s = memory_order_seq_cst) volatile
6006 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
6007 __translate_memory_order(__s));}
6008 _LIBCPP_INLINE_VISIBILITY
6009 bool compare_exchange_strong(int& __v, int __e,
6010 memory_order __s = memory_order_seq_cst)
6011 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
6012 __translate_memory_order(__s));}
6013 _LIBCPP_INLINE_VISIBILITY
6014 int fetch_add(int __v, memory_order __o = memory_order_seq_cst) volatile
6015 {return atomic_fetch_add_explicit(this, __v, __o);}
6016 _LIBCPP_INLINE_VISIBILITY
6017 int fetch_add(int __v, memory_order __o = memory_order_seq_cst)
6018 {return atomic_fetch_add_explicit(this, __v, __o);}
6019 _LIBCPP_INLINE_VISIBILITY
6020 int fetch_sub(int __v, memory_order __o = memory_order_seq_cst) volatile
6021 {return atomic_fetch_sub_explicit(this, __v, __o);}
6022 _LIBCPP_INLINE_VISIBILITY
6023 int fetch_sub(int __v, memory_order __o = memory_order_seq_cst)
6024 {return atomic_fetch_sub_explicit(this, __v, __o);}
6025 _LIBCPP_INLINE_VISIBILITY
6026 int fetch_and(int __v, memory_order __o = memory_order_seq_cst) volatile
6027 {return atomic_fetch_and_explicit(this, __v, __o);}
6028 _LIBCPP_INLINE_VISIBILITY
6029 int fetch_and(int __v, memory_order __o = memory_order_seq_cst)
6030 {return atomic_fetch_and_explicit(this, __v, __o);}
6031 _LIBCPP_INLINE_VISIBILITY
6032 int fetch_or(int __v, memory_order __o = memory_order_seq_cst) volatile
6033 {return atomic_fetch_or_explicit(this, __v, __o);}
6034 _LIBCPP_INLINE_VISIBILITY
6035 int fetch_or(int __v, memory_order __o = memory_order_seq_cst)
6036 {return atomic_fetch_or_explicit(this, __v, __o);}
6037 _LIBCPP_INLINE_VISIBILITY
6038 int fetch_xor(int __v, memory_order __o = memory_order_seq_cst) volatile
6039 {return atomic_fetch_xor_explicit(this, __v, __o);}
6040 _LIBCPP_INLINE_VISIBILITY
6041 int fetch_xor(int __v, memory_order __o = memory_order_seq_cst)
6042 {return atomic_fetch_xor_explicit(this, __v, __o);}
6043#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
6044 atomic_int() = default;
6045#else
6046 _LIBCPP_INLINE_VISIBILITY
6047 atomic_int() {}
6048#endif
6049 _LIBCPP_INLINE_VISIBILITY
6050 /*constexpr*/ atomic_int(int __v)
6051 : __v_(__v) {}
6052#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
6053 atomic_int(const atomic_int&) = delete;
6054 atomic_int& operator=(const atomic_int&) = delete;
6055 atomic_int& operator=(const atomic_int&) volatile = delete;
6056#else
6057private:
6058 atomic_int(const atomic_int&);
6059 atomic_int& operator=(const atomic_int&);
6060 atomic_int& operator=(const atomic_int&) volatile;
6061public:
6062#endif
6063 _LIBCPP_INLINE_VISIBILITY
6064 int operator=(int __v) volatile
6065 {store(__v); return __v;}
6066 _LIBCPP_INLINE_VISIBILITY
6067 int operator=(int __v)
6068 {store(__v); return __v;}
6069 _LIBCPP_INLINE_VISIBILITY
6070 int operator++(int) volatile
6071 {return fetch_add(int(1));}
6072 _LIBCPP_INLINE_VISIBILITY
6073 int operator++(int)
6074 {return fetch_add(int(1));}
6075 _LIBCPP_INLINE_VISIBILITY
6076 int operator--(int) volatile
6077 {return fetch_sub(int(1));}
6078 _LIBCPP_INLINE_VISIBILITY
6079 int operator--(int)
6080 {return fetch_sub(int(1));}
6081 _LIBCPP_INLINE_VISIBILITY
6082 int operator++() volatile
6083 {return int(fetch_add(int(1)) + 1);}
6084 _LIBCPP_INLINE_VISIBILITY
6085 int operator++()
6086 {return int(fetch_add(int(1)) + 1);}
6087 _LIBCPP_INLINE_VISIBILITY
6088 int operator--() volatile
6089 {return int(fetch_sub(int(1)) - 1);}
6090 _LIBCPP_INLINE_VISIBILITY
6091 int operator--()
6092 {return int(fetch_sub(int(1)) - 1);}
6093 _LIBCPP_INLINE_VISIBILITY
6094 int operator+=(int __v) volatile
6095 {return int(fetch_add(__v) + __v);}
6096 _LIBCPP_INLINE_VISIBILITY
6097 int operator+=(int __v)
6098 {return int(fetch_add(__v) + __v);}
6099 _LIBCPP_INLINE_VISIBILITY
6100 int operator-=(int __v) volatile
6101 {return int(fetch_sub(__v) - __v);}
6102 _LIBCPP_INLINE_VISIBILITY
6103 int operator-=(int __v)
6104 {return int(fetch_sub(__v) - __v);}
6105 _LIBCPP_INLINE_VISIBILITY
6106 int operator&=(int __v) volatile
6107 {return int(fetch_and(__v) & __v);}
6108 _LIBCPP_INLINE_VISIBILITY
6109 int operator&=(int __v)
6110 {return int(fetch_and(__v) & __v);}
6111 _LIBCPP_INLINE_VISIBILITY
6112 int operator|=(int __v) volatile
6113 {return int(fetch_or(__v) | __v);}
6114 _LIBCPP_INLINE_VISIBILITY
6115 int operator|=(int __v)
6116 {return int(fetch_or(__v) | __v);}
6117 _LIBCPP_INLINE_VISIBILITY
6118 int operator^=(int __v) volatile
6119 {return int(fetch_xor(__v) ^ __v);}
6120 _LIBCPP_INLINE_VISIBILITY
6121 int operator^=(int __v)
6122 {return int(fetch_xor(__v) ^ __v);}
6123} atomic_int;
6124
6125inline _LIBCPP_INLINE_VISIBILITY
6126bool
6127atomic_is_lock_free(const volatile atomic_int*)
6128{
6129 typedef int type;
6130 return __atomic_is_lock_free(type);
6131}
6132
6133inline _LIBCPP_INLINE_VISIBILITY
6134bool
6135atomic_is_lock_free(const atomic_int* __obj)
6136{
6137 return atomic_is_lock_free(const_cast<volatile atomic_int*>(__obj));
6138}
6139
6140inline _LIBCPP_INLINE_VISIBILITY
6141void
6142atomic_init(volatile atomic_int* __obj, int __desr)
6143{
6144 __obj->__v_ = __desr;
6145}
6146
6147inline _LIBCPP_INLINE_VISIBILITY
6148void
6149atomic_init(atomic_int* __obj, int __desr)
6150{
6151 __obj->__v_ = __desr;
6152}
6153
6154inline _LIBCPP_INLINE_VISIBILITY
6155void
6156atomic_store(volatile atomic_int* __obj, int __desr)
6157{
6158 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
6159}
6160
6161inline _LIBCPP_INLINE_VISIBILITY
6162void
6163atomic_store(atomic_int* __obj, int __desr)
6164{
6165 atomic_store(const_cast<volatile atomic_int*>(__obj), __desr);
6166}
6167
6168inline _LIBCPP_INLINE_VISIBILITY
6169void
6170atomic_store_explicit(volatile atomic_int* __obj, int __desr,
6171 memory_order __o)
6172{
6173 __atomic_store(&__obj->__v_, __desr, __o);
6174}
6175
6176inline _LIBCPP_INLINE_VISIBILITY
6177void
6178atomic_store_explicit(atomic_int* __obj, int __desr, memory_order __o)
6179{
6180 atomic_store_explicit(const_cast<volatile atomic_int*>(__obj), __desr,
6181 __o);
6182}
6183
6184inline _LIBCPP_INLINE_VISIBILITY
6185int
6186atomic_load(const volatile atomic_int* __obj)
6187{
6188 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
6189}
6190
6191inline _LIBCPP_INLINE_VISIBILITY
6192int
6193atomic_load(const atomic_int* __obj)
6194{
6195 return atomic_load(const_cast<const volatile atomic_int*>(__obj));
6196}
6197
6198inline _LIBCPP_INLINE_VISIBILITY
6199int
6200atomic_load_explicit(const volatile atomic_int* __obj, memory_order __o)
6201{
6202 return __atomic_load(&__obj->__v_, __o);
6203}
6204
6205inline _LIBCPP_INLINE_VISIBILITY
6206int
6207atomic_load_explicit(const atomic_int* __obj, memory_order __o)
6208{
6209 return atomic_load_explicit(const_cast<const volatile atomic_int*>
6210 (__obj), __o);
6211}
6212
6213inline _LIBCPP_INLINE_VISIBILITY
6214int
6215atomic_exchange(volatile atomic_int* __obj, int __desr)
6216{
6217 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
6218}
6219
6220inline _LIBCPP_INLINE_VISIBILITY
6221int
6222atomic_exchange(atomic_int* __obj, int __desr)
6223{
6224 return atomic_exchange(const_cast<volatile atomic_int*>(__obj), __desr);
6225}
6226
6227inline _LIBCPP_INLINE_VISIBILITY
6228int
6229atomic_exchange_explicit(volatile atomic_int* __obj, int __desr,
6230 memory_order __o)
6231{
6232 return __atomic_exchange(&__obj->__v_, __desr, __o);
6233}
6234
6235inline _LIBCPP_INLINE_VISIBILITY
6236int
6237atomic_exchange_explicit(atomic_int* __obj, int __desr, memory_order __o)
6238{
6239 return atomic_exchange_explicit(const_cast<volatile atomic_int*>
6240 (__obj), __desr, __o);
6241}
6242
6243inline _LIBCPP_INLINE_VISIBILITY
6244bool
6245atomic_compare_exchange_weak(volatile atomic_int* __obj, int* __exp,
6246 int __desr)
6247{
6248 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
6249 memory_order_seq_cst, memory_order_seq_cst);
6250}
6251
6252inline _LIBCPP_INLINE_VISIBILITY
6253bool
6254atomic_compare_exchange_weak(atomic_int* __obj, int* __exp, int __desr)
6255{
6256 return atomic_compare_exchange_weak(const_cast<volatile atomic_int*>
6257 (__obj), __exp, __desr);
6258}
6259
6260inline _LIBCPP_INLINE_VISIBILITY
6261bool
6262atomic_compare_exchange_strong(volatile atomic_int* __obj, int* __exp,
6263 int __desr)
6264{
6265 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
6266 memory_order_seq_cst, memory_order_seq_cst);
6267}
6268
6269inline _LIBCPP_INLINE_VISIBILITY
6270bool
6271atomic_compare_exchange_strong(atomic_int* __obj, int* __exp, int __desr)
6272{
6273 return atomic_compare_exchange_strong(const_cast<volatile atomic_int*>
6274 (__obj), __exp, __desr);
6275}
6276
6277inline _LIBCPP_INLINE_VISIBILITY
6278bool
6279atomic_compare_exchange_weak_explicit(volatile atomic_int* __obj, int* __exp,
6280 int __desr, memory_order __s,
6281 memory_order __f)
6282{
6283 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
6284 __f);
6285}
6286
6287inline _LIBCPP_INLINE_VISIBILITY
6288bool
6289atomic_compare_exchange_weak_explicit(atomic_int* __obj, int* __exp,
6290 int __desr, memory_order __s,
6291 memory_order __f)
6292{
6293 return atomic_compare_exchange_weak_explicit(
6294 const_cast<volatile atomic_int*>(__obj), __exp, __desr, __s, __f);
6295}
6296
6297inline _LIBCPP_INLINE_VISIBILITY
6298bool
6299atomic_compare_exchange_strong_explicit(volatile atomic_int* __obj,
6300 int* __exp, int __desr,
6301 memory_order __s, memory_order __f)
6302{
6303 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
6304 __f);
6305}
6306
6307inline _LIBCPP_INLINE_VISIBILITY
6308bool
6309atomic_compare_exchange_strong_explicit(atomic_int* __obj, int* __exp,
6310 int __desr, memory_order __s,
6311 memory_order __f)
6312{
6313 return atomic_compare_exchange_strong_explicit(
6314 const_cast<volatile atomic_int*>(__obj), __exp, __desr, __s, __f);
6315}
6316
6317inline _LIBCPP_INLINE_VISIBILITY
6318int
6319atomic_fetch_add(volatile atomic_int* __obj, int __v)
6320{
6321 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
6322}
6323
6324inline _LIBCPP_INLINE_VISIBILITY
6325int
6326atomic_fetch_add(atomic_int* __obj, int __v)
6327{
6328 return atomic_fetch_add(const_cast<volatile atomic_int*>(__obj), __v);
6329}
6330
6331inline _LIBCPP_INLINE_VISIBILITY
6332int
6333atomic_fetch_add_explicit(volatile atomic_int* __obj, int __v,
6334 memory_order __o)
6335{
6336 return __atomic_fetch_add(&__obj->__v_, __v, __o);
6337}
6338
6339inline _LIBCPP_INLINE_VISIBILITY
6340int
6341atomic_fetch_add_explicit(atomic_int* __obj, int __v, memory_order __o)
6342{
6343 return atomic_fetch_add_explicit(const_cast<volatile atomic_int*>(__obj),
6344 __v, __o);
6345}
6346
6347inline _LIBCPP_INLINE_VISIBILITY
6348int
6349atomic_fetch_sub(volatile atomic_int* __obj, int __v)
6350{
6351 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
6352}
6353
6354inline _LIBCPP_INLINE_VISIBILITY
6355int
6356atomic_fetch_sub(atomic_int* __obj, int __v)
6357{
6358 return atomic_fetch_sub(const_cast<volatile atomic_int*>(__obj), __v);
6359}
6360
6361inline _LIBCPP_INLINE_VISIBILITY
6362int
6363atomic_fetch_sub_explicit(volatile atomic_int* __obj, int __v,
6364 memory_order __o)
6365{
6366 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
6367}
6368
6369inline _LIBCPP_INLINE_VISIBILITY
6370int
6371atomic_fetch_sub_explicit(atomic_int* __obj, int __v, memory_order __o)
6372{
6373 return atomic_fetch_sub_explicit(const_cast<volatile atomic_int*>(__obj),
6374 __v, __o);
6375}
6376
6377inline _LIBCPP_INLINE_VISIBILITY
6378int
6379atomic_fetch_and(volatile atomic_int* __obj, int __v)
6380{
6381 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
6382}
6383
6384inline _LIBCPP_INLINE_VISIBILITY
6385int
6386atomic_fetch_and(atomic_int* __obj, int __v)
6387{
6388 return atomic_fetch_and(const_cast<volatile atomic_int*>(__obj), __v);
6389}
6390
6391inline _LIBCPP_INLINE_VISIBILITY
6392int
6393atomic_fetch_and_explicit(volatile atomic_int* __obj, int __v,
6394 memory_order __o)
6395{
6396 return __atomic_fetch_and(&__obj->__v_, __v, __o);
6397}
6398
6399inline _LIBCPP_INLINE_VISIBILITY
6400int
6401atomic_fetch_and_explicit(atomic_int* __obj, int __v, memory_order __o)
6402{
6403 return atomic_fetch_and_explicit(const_cast<volatile atomic_int*>(__obj),
6404 __v, __o);
6405}
6406
6407inline _LIBCPP_INLINE_VISIBILITY
6408int
6409atomic_fetch_or(volatile atomic_int* __obj, int __v)
6410{
6411 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
6412}
6413
6414inline _LIBCPP_INLINE_VISIBILITY
6415int
6416atomic_fetch_or(atomic_int* __obj, int __v)
6417{
6418 return atomic_fetch_or(const_cast<volatile atomic_int*>(__obj), __v);
6419}
6420
6421inline _LIBCPP_INLINE_VISIBILITY
6422int
6423atomic_fetch_or_explicit(volatile atomic_int* __obj, int __v,
6424 memory_order __o)
6425{
6426 return __atomic_fetch_or(&__obj->__v_, __v, __o);
6427}
6428
6429inline _LIBCPP_INLINE_VISIBILITY
6430int
6431atomic_fetch_or_explicit(atomic_int* __obj, int __v, memory_order __o)
6432{
6433 return atomic_fetch_or_explicit(const_cast<volatile atomic_int*>(__obj),
6434 __v, __o);
6435}
6436
6437inline _LIBCPP_INLINE_VISIBILITY
6438int
6439atomic_fetch_xor(volatile atomic_int* __obj, int __v)
6440{
6441 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
6442}
6443
6444inline _LIBCPP_INLINE_VISIBILITY
6445int
6446atomic_fetch_xor(atomic_int* __obj, int __v)
6447{
6448 return atomic_fetch_xor(const_cast<volatile atomic_int*>(__obj), __v);
6449}
6450
6451inline _LIBCPP_INLINE_VISIBILITY
6452int
6453atomic_fetch_xor_explicit(volatile atomic_int* __obj, int __v,
6454 memory_order __o)
6455{
6456 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
6457}
6458
6459inline _LIBCPP_INLINE_VISIBILITY
6460int
6461atomic_fetch_xor_explicit(atomic_int* __obj, int __v, memory_order __o)
6462{
6463 return atomic_fetch_xor_explicit(const_cast<volatile atomic_int*>(__obj),
6464 __v, __o);
6465}
6466
6467// atomic_uint
6468
6469struct atomic_uint;
6470
6471bool atomic_is_lock_free(const volatile atomic_uint*);
6472bool atomic_is_lock_free(const atomic_uint*);
6473void atomic_init(volatile atomic_uint*, unsigned int);
6474void atomic_init(atomic_uint*, unsigned int);
6475void atomic_store(volatile atomic_uint*, unsigned int);
6476void atomic_store(atomic_uint*, unsigned int);
6477void atomic_store_explicit(volatile atomic_uint*, unsigned int, memory_order);
6478void atomic_store_explicit(atomic_uint*, unsigned int, memory_order);
6479unsigned int atomic_load(const volatile atomic_uint*);
6480unsigned int atomic_load(const atomic_uint*);
6481unsigned int atomic_load_explicit(const volatile atomic_uint*, memory_order);
6482unsigned int atomic_load_explicit(const atomic_uint*, memory_order);
6483unsigned int atomic_exchange(volatile atomic_uint*, unsigned int);
6484unsigned int atomic_exchange(atomic_uint*, unsigned int);
6485unsigned int atomic_exchange_explicit(volatile atomic_uint*, unsigned int,
6486 memory_order);
6487unsigned int atomic_exchange_explicit(atomic_uint*, unsigned int,
6488 memory_order);
6489bool atomic_compare_exchange_weak(volatile atomic_uint*, unsigned int*,
6490 unsigned int);
6491bool atomic_compare_exchange_weak(atomic_uint*, unsigned int*, unsigned int);
6492bool atomic_compare_exchange_strong(volatile atomic_uint*, unsigned int*,
6493 unsigned int);
6494bool atomic_compare_exchange_strong(atomic_uint*, unsigned int*,
6495 unsigned int);
6496bool atomic_compare_exchange_weak_explicit(volatile atomic_uint*,
6497 unsigned int*, unsigned int,
6498 memory_order, memory_order);
6499bool atomic_compare_exchange_weak_explicit(atomic_uint*, unsigned int*,
6500 unsigned int, memory_order,
6501 memory_order);
6502bool atomic_compare_exchange_strong_explicit(volatile atomic_uint*,
6503 unsigned int*, unsigned int,
6504 memory_order, memory_order);
6505bool atomic_compare_exchange_strong_explicit(atomic_uint*, unsigned int*,
6506 unsigned int, memory_order,
6507 memory_order);
6508unsigned int atomic_fetch_add(volatile atomic_uint*, unsigned int);
6509unsigned int atomic_fetch_add(atomic_uint*, unsigned int);
6510unsigned int atomic_fetch_add_explicit(volatile atomic_uint*, unsigned int,
6511 memory_order);
6512unsigned int atomic_fetch_add_explicit(atomic_uint*, unsigned int,
6513 memory_order);
6514unsigned int atomic_fetch_sub(volatile atomic_uint*, unsigned int);
6515unsigned int atomic_fetch_sub(atomic_uint*, unsigned int);
6516unsigned int atomic_fetch_sub_explicit(volatile atomic_uint*, unsigned int,
6517 memory_order);
6518unsigned int atomic_fetch_sub_explicit(atomic_uint*, unsigned int,
6519 memory_order);
6520unsigned int atomic_fetch_and(volatile atomic_uint*, unsigned int);
6521unsigned int atomic_fetch_and(atomic_uint*, unsigned int);
6522unsigned int atomic_fetch_and_explicit(volatile atomic_uint*, unsigned int,
6523 memory_order);
6524unsigned int atomic_fetch_and_explicit(atomic_uint*, unsigned int,
6525 memory_order);
6526unsigned int atomic_fetch_or(volatile atomic_uint*, unsigned int);
6527unsigned int atomic_fetch_or(atomic_uint*, unsigned int);
6528unsigned int atomic_fetch_or_explicit(volatile atomic_uint*, unsigned int,
6529 memory_order);
6530unsigned int atomic_fetch_or_explicit(atomic_uint*, unsigned int,
6531 memory_order);
6532unsigned int atomic_fetch_xor(volatile atomic_uint*, unsigned int);
6533unsigned int atomic_fetch_xor(atomic_uint*, unsigned int);
6534unsigned int atomic_fetch_xor_explicit(volatile atomic_uint*, unsigned int,
6535 memory_order);
6536unsigned int atomic_fetch_xor_explicit(atomic_uint*, unsigned int,
6537 memory_order);
6538
6539typedef struct atomic_uint
6540{
6541 unsigned int __v_;
6542
6543 _LIBCPP_INLINE_VISIBILITY
6544 bool is_lock_free() const volatile
6545 {return atomic_is_lock_free(this);}
6546 _LIBCPP_INLINE_VISIBILITY
6547 bool is_lock_free() const
6548 {return atomic_is_lock_free(this);}
6549 _LIBCPP_INLINE_VISIBILITY
6550 void store(unsigned int __v,
6551 memory_order __o = memory_order_seq_cst) volatile
6552 {atomic_store_explicit(this, __v, __o);}
6553 _LIBCPP_INLINE_VISIBILITY
6554 void store(unsigned int __v, memory_order __o = memory_order_seq_cst)
6555 {atomic_store_explicit(this, __v, __o);}
6556 _LIBCPP_INLINE_VISIBILITY
6557 unsigned int load(memory_order __o = memory_order_seq_cst) const volatile
6558 {return atomic_load_explicit(this, __o);}
6559 _LIBCPP_INLINE_VISIBILITY
6560 unsigned int load(memory_order __o = memory_order_seq_cst) const
6561 {return atomic_load_explicit(this, __o);}
6562 _LIBCPP_INLINE_VISIBILITY
6563 operator unsigned int() const volatile
6564 {return load();}
6565 _LIBCPP_INLINE_VISIBILITY
6566 operator unsigned int() const
6567 {return load();}
6568 _LIBCPP_INLINE_VISIBILITY
6569 unsigned int exchange(unsigned int __v,
6570 memory_order __o = memory_order_seq_cst) volatile
6571 {return atomic_exchange_explicit(this, __v, __o);}
6572 _LIBCPP_INLINE_VISIBILITY
6573 unsigned int exchange(unsigned int __v,
6574 memory_order __o = memory_order_seq_cst)
6575 {return atomic_exchange_explicit(this, __v, __o);}
6576 _LIBCPP_INLINE_VISIBILITY
6577 bool compare_exchange_weak(unsigned int& __v, unsigned int __e,
6578 memory_order __s, memory_order __f) volatile
6579 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
6580 __f);}
6581 _LIBCPP_INLINE_VISIBILITY
6582 bool compare_exchange_weak(unsigned int& __v, unsigned int __e,
6583 memory_order __s, memory_order __f)
6584 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
6585 __f);}
6586 _LIBCPP_INLINE_VISIBILITY
6587 bool compare_exchange_strong(unsigned int& __v, unsigned int __e,
6588 memory_order __s, memory_order __f) volatile
6589 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
6590 __f);}
6591 _LIBCPP_INLINE_VISIBILITY
6592 bool compare_exchange_strong(unsigned int& __v, unsigned int __e,
6593 memory_order __s, memory_order __f)
6594 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
6595 __f);}
6596 _LIBCPP_INLINE_VISIBILITY
6597 bool compare_exchange_weak(unsigned int& __v, unsigned int __e,
6598 memory_order __s = memory_order_seq_cst) volatile
6599 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
6600 __translate_memory_order(__s));}
6601 _LIBCPP_INLINE_VISIBILITY
6602 bool compare_exchange_weak(unsigned int& __v, unsigned int __e,
6603 memory_order __s = memory_order_seq_cst)
6604 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
6605 __translate_memory_order(__s));}
6606 _LIBCPP_INLINE_VISIBILITY
6607 bool compare_exchange_strong(unsigned int& __v, unsigned int __e,
6608 memory_order __s = memory_order_seq_cst) volatile
6609 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
6610 __translate_memory_order(__s));}
6611 _LIBCPP_INLINE_VISIBILITY
6612 bool compare_exchange_strong(unsigned int& __v, unsigned int __e,
6613 memory_order __s = memory_order_seq_cst)
6614 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
6615 __translate_memory_order(__s));}
6616 _LIBCPP_INLINE_VISIBILITY
6617 unsigned int fetch_add(unsigned int __v,
6618 memory_order __o = memory_order_seq_cst) volatile
6619 {return atomic_fetch_add_explicit(this, __v, __o);}
6620 _LIBCPP_INLINE_VISIBILITY
6621 unsigned int fetch_add(unsigned int __v,
6622 memory_order __o = memory_order_seq_cst)
6623 {return atomic_fetch_add_explicit(this, __v, __o);}
6624 _LIBCPP_INLINE_VISIBILITY
6625 unsigned int fetch_sub(unsigned int __v,
6626 memory_order __o = memory_order_seq_cst) volatile
6627 {return atomic_fetch_sub_explicit(this, __v, __o);}
6628 _LIBCPP_INLINE_VISIBILITY
6629 unsigned int fetch_sub(unsigned int __v,
6630 memory_order __o = memory_order_seq_cst)
6631 {return atomic_fetch_sub_explicit(this, __v, __o);}
6632 _LIBCPP_INLINE_VISIBILITY
6633 unsigned int fetch_and(unsigned int __v,
6634 memory_order __o = memory_order_seq_cst) volatile
6635 {return atomic_fetch_and_explicit(this, __v, __o);}
6636 _LIBCPP_INLINE_VISIBILITY
6637 unsigned int fetch_and(unsigned int __v,
6638 memory_order __o = memory_order_seq_cst)
6639 {return atomic_fetch_and_explicit(this, __v, __o);}
6640 _LIBCPP_INLINE_VISIBILITY
6641 unsigned int fetch_or(unsigned int __v,
6642 memory_order __o = memory_order_seq_cst) volatile
6643 {return atomic_fetch_or_explicit(this, __v, __o);}
6644 _LIBCPP_INLINE_VISIBILITY
6645 unsigned int fetch_or(unsigned int __v,
6646 memory_order __o = memory_order_seq_cst)
6647 {return atomic_fetch_or_explicit(this, __v, __o);}
6648 _LIBCPP_INLINE_VISIBILITY
6649 unsigned int fetch_xor(unsigned int __v,
6650 memory_order __o = memory_order_seq_cst) volatile
6651 {return atomic_fetch_xor_explicit(this, __v, __o);}
6652 _LIBCPP_INLINE_VISIBILITY
6653 unsigned int fetch_xor(unsigned int __v,
6654 memory_order __o = memory_order_seq_cst)
6655 {return atomic_fetch_xor_explicit(this, __v, __o);}
6656#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
6657 atomic_uint() = default;
6658#else
6659 _LIBCPP_INLINE_VISIBILITY
6660 atomic_uint() {}
6661#endif
6662 _LIBCPP_INLINE_VISIBILITY
6663 /*constexpr*/ atomic_uint(unsigned int __v)
6664 : __v_(__v) {}
6665#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
6666 atomic_uint(const atomic_uint&) = delete;
6667 atomic_uint& operator=(const atomic_uint&) = delete;
6668 atomic_uint& operator=(const atomic_uint&) volatile = delete;
6669#else
6670private:
6671 atomic_uint(const atomic_uint&);
6672 atomic_uint& operator=(const atomic_uint&);
6673 atomic_uint& operator=(const atomic_uint&) volatile;
6674public:
6675#endif
6676 _LIBCPP_INLINE_VISIBILITY
6677 unsigned int operator=(unsigned int __v) volatile
6678 {store(__v); return __v;}
6679 _LIBCPP_INLINE_VISIBILITY
6680 unsigned int operator=(unsigned int __v)
6681 {store(__v); return __v;}
6682 _LIBCPP_INLINE_VISIBILITY
6683 unsigned int operator++(int) volatile
6684 {typedef unsigned int type; return fetch_add(type(1));}
6685 _LIBCPP_INLINE_VISIBILITY
6686 int operator++(int)
6687 {typedef unsigned int type; return fetch_add(type(1));}
6688 _LIBCPP_INLINE_VISIBILITY
6689 int operator--(int) volatile
6690 {typedef unsigned int type; return fetch_sub(type(1));}
6691 _LIBCPP_INLINE_VISIBILITY
6692 int operator--(int)
6693 {typedef unsigned int type; return fetch_sub(type(1));}
6694 _LIBCPP_INLINE_VISIBILITY
6695 int operator++() volatile
6696 {typedef unsigned int type; return type(fetch_add(type(1)) + 1);}
6697 _LIBCPP_INLINE_VISIBILITY
6698 int operator++()
6699 {typedef unsigned int type; return type(fetch_add(type(1)) + 1);}
6700 _LIBCPP_INLINE_VISIBILITY
6701 int operator--() volatile
6702 {typedef unsigned int type; return type(fetch_sub(type(1)) - 1);}
6703 _LIBCPP_INLINE_VISIBILITY
6704 int operator--()
6705 {typedef unsigned int type; return type(fetch_sub(type(1)) - 1);}
6706 _LIBCPP_INLINE_VISIBILITY
6707 int operator+=(int __v) volatile
6708 {typedef unsigned int type; return type(fetch_add(__v) + __v);}
6709 _LIBCPP_INLINE_VISIBILITY
6710 int operator+=(int __v)
6711 {typedef unsigned int type; return type(fetch_add(__v) + __v);}
6712 _LIBCPP_INLINE_VISIBILITY
6713 int operator-=(int __v) volatile
6714 {typedef unsigned int type; return type(fetch_sub(__v) - __v);}
6715 _LIBCPP_INLINE_VISIBILITY
6716 int operator-=(int __v)
6717 {typedef unsigned int type; return type(fetch_sub(__v) - __v);}
6718 _LIBCPP_INLINE_VISIBILITY
6719 int operator&=(int __v) volatile
6720 {typedef unsigned int type; return type(fetch_and(__v) & __v);}
6721 _LIBCPP_INLINE_VISIBILITY
6722 int operator&=(int __v)
6723 {typedef unsigned int type; return type(fetch_and(__v) & __v);}
6724 _LIBCPP_INLINE_VISIBILITY
6725 int operator|=(int __v) volatile
6726 {typedef unsigned int type; return type(fetch_or(__v) | __v);}
6727 _LIBCPP_INLINE_VISIBILITY
6728 int operator|=(int __v)
6729 {typedef unsigned int type; return type(fetch_or(__v) | __v);}
6730 _LIBCPP_INLINE_VISIBILITY
6731 int operator^=(int __v) volatile
6732 {typedef unsigned int type; return type(fetch_xor(__v) ^ __v);}
6733 _LIBCPP_INLINE_VISIBILITY
6734 int operator^=(int __v)
6735 {typedef unsigned int type; return type(fetch_xor(__v) ^ __v);}
6736} atomic_uint;
6737
6738inline _LIBCPP_INLINE_VISIBILITY
6739bool
6740atomic_is_lock_free(const volatile atomic_uint*)
6741{
6742 typedef unsigned int type;
6743 return __atomic_is_lock_free(type);
6744}
6745
6746inline _LIBCPP_INLINE_VISIBILITY
6747bool
6748atomic_is_lock_free(const atomic_uint* __obj)
6749{
6750 return atomic_is_lock_free(const_cast<volatile atomic_uint*>(__obj));
6751}
6752
6753inline _LIBCPP_INLINE_VISIBILITY
6754void
6755atomic_init(volatile atomic_uint* __obj, unsigned int __desr)
6756{
6757 __obj->__v_ = __desr;
6758}
6759
6760inline _LIBCPP_INLINE_VISIBILITY
6761void
6762atomic_init(atomic_uint* __obj, unsigned int __desr)
6763{
6764 __obj->__v_ = __desr;
6765}
6766
6767inline _LIBCPP_INLINE_VISIBILITY
6768void
6769atomic_store(volatile atomic_uint* __obj, unsigned int __desr)
6770{
6771 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
6772}
6773
6774inline _LIBCPP_INLINE_VISIBILITY
6775void
6776atomic_store(atomic_uint* __obj, unsigned int __desr)
6777{
6778 atomic_store(const_cast<volatile atomic_uint*>(__obj), __desr);
6779}
6780
6781inline _LIBCPP_INLINE_VISIBILITY
6782void
6783atomic_store_explicit(volatile atomic_uint* __obj, unsigned int __desr,
6784 memory_order __o)
6785{
6786 __atomic_store(&__obj->__v_, __desr, __o);
6787}
6788
6789inline _LIBCPP_INLINE_VISIBILITY
6790void
6791atomic_store_explicit(atomic_uint* __obj, unsigned int __desr,
6792 memory_order __o)
6793{
6794 atomic_store_explicit(const_cast<volatile atomic_uint*>(__obj), __desr,
6795 __o);
6796}
6797
6798inline _LIBCPP_INLINE_VISIBILITY
6799unsigned int
6800atomic_load(const volatile atomic_uint* __obj)
6801{
6802 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
6803}
6804
6805inline _LIBCPP_INLINE_VISIBILITY
6806unsigned int
6807atomic_load(const atomic_uint* __obj)
6808{
6809 return atomic_load(const_cast<const volatile atomic_uint*>(__obj));
6810}
6811
6812inline _LIBCPP_INLINE_VISIBILITY
6813unsigned int
6814atomic_load_explicit(const volatile atomic_uint* __obj, memory_order __o)
6815{
6816 return __atomic_load(&__obj->__v_, __o);
6817}
6818
6819inline _LIBCPP_INLINE_VISIBILITY
6820unsigned int
6821atomic_load_explicit(const atomic_uint* __obj, memory_order __o)
6822{
6823 return atomic_load_explicit(const_cast<const volatile atomic_uint*>
6824 (__obj), __o);
6825}
6826
6827inline _LIBCPP_INLINE_VISIBILITY
6828unsigned int
6829atomic_exchange(volatile atomic_uint* __obj, unsigned int __desr)
6830{
6831 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
6832}
6833
6834inline _LIBCPP_INLINE_VISIBILITY
6835unsigned int
6836atomic_exchange(atomic_uint* __obj, unsigned int __desr)
6837{
6838 return atomic_exchange(const_cast<volatile atomic_uint*>(__obj), __desr);
6839}
6840
6841inline _LIBCPP_INLINE_VISIBILITY
6842unsigned int
6843atomic_exchange_explicit(volatile atomic_uint* __obj, unsigned int __desr,
6844 memory_order __o)
6845{
6846 return __atomic_exchange(&__obj->__v_, __desr, __o);
6847}
6848
6849inline _LIBCPP_INLINE_VISIBILITY
6850unsigned int
6851atomic_exchange_explicit(atomic_uint* __obj, unsigned int __desr,
6852 memory_order __o)
6853{
6854 return atomic_exchange_explicit(const_cast<volatile atomic_uint*>
6855 (__obj), __desr, __o);
6856}
6857
6858inline _LIBCPP_INLINE_VISIBILITY
6859bool
6860atomic_compare_exchange_weak(volatile atomic_uint* __obj, unsigned int* __exp,
6861 unsigned int __desr)
6862{
6863 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
6864 memory_order_seq_cst, memory_order_seq_cst);
6865}
6866
6867inline _LIBCPP_INLINE_VISIBILITY
6868bool
6869atomic_compare_exchange_weak(atomic_uint* __obj, unsigned int* __exp,
6870 unsigned int __desr)
6871{
6872 return atomic_compare_exchange_weak(const_cast<volatile atomic_uint*>
6873 (__obj), __exp, __desr);
6874}
6875
6876inline _LIBCPP_INLINE_VISIBILITY
6877bool
6878atomic_compare_exchange_strong(volatile atomic_uint* __obj,
6879 unsigned int* __exp, unsigned int __desr)
6880{
6881 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
6882 memory_order_seq_cst, memory_order_seq_cst);
6883}
6884
6885inline _LIBCPP_INLINE_VISIBILITY
6886bool
6887atomic_compare_exchange_strong(atomic_uint* __obj, unsigned int* __exp,
6888 unsigned int __desr)
6889{
6890 return atomic_compare_exchange_strong(const_cast<volatile atomic_uint*>
6891 (__obj), __exp, __desr);
6892}
6893
6894inline _LIBCPP_INLINE_VISIBILITY
6895bool
6896atomic_compare_exchange_weak_explicit(volatile atomic_uint* __obj,
6897 unsigned int* __exp,
6898 unsigned int __desr, memory_order __s,
6899 memory_order __f)
6900{
6901 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
6902 __f);
6903}
6904
6905inline _LIBCPP_INLINE_VISIBILITY
6906bool
6907atomic_compare_exchange_weak_explicit(atomic_uint* __obj, unsigned int* __exp,
6908 unsigned int __desr, memory_order __s,
6909 memory_order __f)
6910{
6911 return atomic_compare_exchange_weak_explicit(
6912 const_cast<volatile atomic_uint*>(__obj), __exp, __desr, __s, __f);
6913}
6914
6915inline _LIBCPP_INLINE_VISIBILITY
6916bool
6917atomic_compare_exchange_strong_explicit(volatile atomic_uint* __obj,
6918 unsigned int* __exp,
6919 unsigned int __desr, memory_order __s,
6920 memory_order __f)
6921{
6922 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
6923 __f);
6924}
6925
6926inline _LIBCPP_INLINE_VISIBILITY
6927bool
6928atomic_compare_exchange_strong_explicit(atomic_uint* __obj,
6929 unsigned int* __exp,
6930 unsigned int __desr, memory_order __s,
6931 memory_order __f)
6932{
6933 return atomic_compare_exchange_strong_explicit(
6934 const_cast<volatile atomic_uint*>(__obj), __exp, __desr, __s, __f);
6935}
6936
6937inline _LIBCPP_INLINE_VISIBILITY
6938unsigned int
6939atomic_fetch_add(volatile atomic_uint* __obj, unsigned int __v)
6940{
6941 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
6942}
6943
6944inline _LIBCPP_INLINE_VISIBILITY
6945unsigned int
6946atomic_fetch_add(atomic_uint* __obj, unsigned int __v)
6947{
6948 return atomic_fetch_add(const_cast<volatile atomic_uint*>(__obj), __v);
6949}
6950
6951inline _LIBCPP_INLINE_VISIBILITY
6952unsigned int
6953atomic_fetch_add_explicit(volatile atomic_uint* __obj, unsigned int __v,
6954 memory_order __o)
6955{
6956 return __atomic_fetch_add(&__obj->__v_, __v, __o);
6957}
6958
6959inline _LIBCPP_INLINE_VISIBILITY
6960unsigned int
6961atomic_fetch_add_explicit(atomic_uint* __obj, unsigned int __v,
6962 memory_order __o)
6963{
6964 return atomic_fetch_add_explicit(const_cast<volatile atomic_uint*>(__obj),
6965 __v, __o);
6966}
6967
6968inline _LIBCPP_INLINE_VISIBILITY
6969unsigned int
6970atomic_fetch_sub(volatile atomic_uint* __obj, unsigned int __v)
6971{
6972 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
6973}
6974
6975inline _LIBCPP_INLINE_VISIBILITY
6976unsigned int
6977atomic_fetch_sub(atomic_uint* __obj, unsigned int __v)
6978{
6979 return atomic_fetch_sub(const_cast<volatile atomic_uint*>(__obj), __v);
6980}
6981
6982inline _LIBCPP_INLINE_VISIBILITY
6983unsigned int
6984atomic_fetch_sub_explicit(volatile atomic_uint* __obj, unsigned int __v,
6985 memory_order __o)
6986{
6987 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
6988}
6989
6990inline _LIBCPP_INLINE_VISIBILITY
6991unsigned int
6992atomic_fetch_sub_explicit(atomic_uint* __obj, unsigned int __v,
6993 memory_order __o)
6994{
6995 return atomic_fetch_sub_explicit(const_cast<volatile atomic_uint*>(__obj),
6996 __v, __o);
6997}
6998
6999inline _LIBCPP_INLINE_VISIBILITY
7000unsigned int
7001atomic_fetch_and(volatile atomic_uint* __obj, unsigned int __v)
7002{
7003 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
7004}
7005
7006inline _LIBCPP_INLINE_VISIBILITY
7007unsigned int
7008atomic_fetch_and(atomic_uint* __obj, unsigned int __v)
7009{
7010 return atomic_fetch_and(const_cast<volatile atomic_uint*>(__obj), __v);
7011}
7012
7013inline _LIBCPP_INLINE_VISIBILITY
7014unsigned int
7015atomic_fetch_and_explicit(volatile atomic_uint* __obj, unsigned int __v,
7016 memory_order __o)
7017{
7018 return __atomic_fetch_and(&__obj->__v_, __v, __o);
7019}
7020
7021inline _LIBCPP_INLINE_VISIBILITY
7022unsigned int
7023atomic_fetch_and_explicit(atomic_uint* __obj, unsigned int __v,
7024 memory_order __o)
7025{
7026 return atomic_fetch_and_explicit(const_cast<volatile atomic_uint*>(__obj),
7027 __v, __o);
7028}
7029
7030inline _LIBCPP_INLINE_VISIBILITY
7031unsigned int
7032atomic_fetch_or(volatile atomic_uint* __obj, unsigned int __v)
7033{
7034 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
7035}
7036
7037inline _LIBCPP_INLINE_VISIBILITY
7038unsigned int
7039atomic_fetch_or(atomic_uint* __obj, unsigned int __v)
7040{
7041 return atomic_fetch_or(const_cast<volatile atomic_uint*>(__obj), __v);
7042}
7043
7044inline _LIBCPP_INLINE_VISIBILITY
7045unsigned int
7046atomic_fetch_or_explicit(volatile atomic_uint* __obj, unsigned int __v,
7047 memory_order __o)
7048{
7049 return __atomic_fetch_or(&__obj->__v_, __v, __o);
7050}
7051
7052inline _LIBCPP_INLINE_VISIBILITY
7053unsigned int
7054atomic_fetch_or_explicit(atomic_uint* __obj, unsigned int __v,
7055 memory_order __o)
7056{
7057 return atomic_fetch_or_explicit(const_cast<volatile atomic_uint*>(__obj),
7058 __v, __o);
7059}
7060
7061inline _LIBCPP_INLINE_VISIBILITY
7062unsigned int
7063atomic_fetch_xor(volatile atomic_uint* __obj, unsigned int __v)
7064{
7065 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
7066}
7067
7068inline _LIBCPP_INLINE_VISIBILITY
7069unsigned int
7070atomic_fetch_xor(atomic_uint* __obj, unsigned int __v)
7071{
7072 return atomic_fetch_xor(const_cast<volatile atomic_uint*>(__obj), __v);
7073}
7074
7075inline _LIBCPP_INLINE_VISIBILITY
7076unsigned int
7077atomic_fetch_xor_explicit(volatile atomic_uint* __obj, unsigned int __v,
7078 memory_order __o)
7079{
7080 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
7081}
7082
7083inline _LIBCPP_INLINE_VISIBILITY
7084unsigned int
7085atomic_fetch_xor_explicit(atomic_uint* __obj, unsigned int __v,
7086 memory_order __o)
7087{
7088 return atomic_fetch_xor_explicit(const_cast<volatile atomic_uint*>(__obj),
7089 __v, __o);
7090}
7091
7092// atomic_long
7093
7094struct atomic_long;
7095
7096bool atomic_is_lock_free(const volatile atomic_long*);
7097bool atomic_is_lock_free(const atomic_long*);
7098void atomic_init(volatile atomic_long*, long);
7099void atomic_init(atomic_long*, long);
7100void atomic_store(volatile atomic_long*, long);
7101void atomic_store(atomic_long*, long);
7102void atomic_store_explicit(volatile atomic_long*, long, memory_order);
7103void atomic_store_explicit(atomic_long*, long, memory_order);
7104long atomic_load(const volatile atomic_long*);
7105long atomic_load(const atomic_long*);
7106long atomic_load_explicit(const volatile atomic_long*, memory_order);
7107long atomic_load_explicit(const atomic_long*, memory_order);
7108long atomic_exchange(volatile atomic_long*, long);
7109long atomic_exchange(atomic_long*, long);
7110long atomic_exchange_explicit(volatile atomic_long*, long, memory_order);
7111long atomic_exchange_explicit(atomic_long*, long, memory_order);
7112bool atomic_compare_exchange_weak(volatile atomic_long*, long*, long);
7113bool atomic_compare_exchange_weak(atomic_long*, long*, long);
7114bool atomic_compare_exchange_strong(volatile atomic_long*, long*, long);
7115bool atomic_compare_exchange_strong(atomic_long*, long*, long);
7116bool atomic_compare_exchange_weak_explicit(volatile atomic_long*, long*, long,
7117 memory_order, memory_order);
7118bool atomic_compare_exchange_weak_explicit(atomic_long*, long*, long,
7119 memory_order, memory_order);
7120bool atomic_compare_exchange_strong_explicit(volatile atomic_long*, long*, long,
7121 memory_order, memory_order);
7122bool atomic_compare_exchange_strong_explicit(atomic_long*, long*, long,
7123 memory_order, memory_order);
7124long atomic_fetch_add(volatile atomic_long*, long);
7125long atomic_fetch_add(atomic_long*, long);
7126long atomic_fetch_add_explicit(volatile atomic_long*, long, memory_order);
7127long atomic_fetch_add_explicit(atomic_long*, long, memory_order);
7128long atomic_fetch_sub(volatile atomic_long*, long);
7129long atomic_fetch_sub(atomic_long*, long);
7130long atomic_fetch_sub_explicit(volatile atomic_long*, long, memory_order);
7131long atomic_fetch_sub_explicit(atomic_long*, long, memory_order);
7132long atomic_fetch_and(volatile atomic_long*, long);
7133long atomic_fetch_and(atomic_long*, long);
7134long atomic_fetch_and_explicit(volatile atomic_long*, long, memory_order);
7135long atomic_fetch_and_explicit(atomic_long*, long, memory_order);
7136long atomic_fetch_or(volatile atomic_long*, long);
7137long atomic_fetch_or(atomic_long*, long);
7138long atomic_fetch_or_explicit(volatile atomic_long*, long, memory_order);
7139long atomic_fetch_or_explicit(atomic_long*, long, memory_order);
7140long atomic_fetch_xor(volatile atomic_long*, long);
7141long atomic_fetch_xor(atomic_long*, long);
7142long atomic_fetch_xor_explicit(volatile atomic_long*, long, memory_order);
7143long atomic_fetch_xor_explicit(atomic_long*, long, memory_order);
7144
7145typedef struct atomic_long
7146{
7147 long __v_;
7148
7149 _LIBCPP_INLINE_VISIBILITY
7150 bool is_lock_free() const volatile
7151 {return atomic_is_lock_free(this);}
7152 _LIBCPP_INLINE_VISIBILITY
7153 bool is_lock_free() const
7154 {return atomic_is_lock_free(this);}
7155 _LIBCPP_INLINE_VISIBILITY
7156 void store(long __v, memory_order __o = memory_order_seq_cst) volatile
7157 {atomic_store_explicit(this, __v, __o);}
7158 _LIBCPP_INLINE_VISIBILITY
7159 void store(long __v, memory_order __o = memory_order_seq_cst)
7160 {atomic_store_explicit(this, __v, __o);}
7161 _LIBCPP_INLINE_VISIBILITY
7162 long load(memory_order __o = memory_order_seq_cst) const volatile
7163 {return atomic_load_explicit(this, __o);}
7164 _LIBCPP_INLINE_VISIBILITY
7165 long load(memory_order __o = memory_order_seq_cst) const
7166 {return atomic_load_explicit(this, __o);}
7167 _LIBCPP_INLINE_VISIBILITY
7168 operator long() const volatile
7169 {return load();}
7170 _LIBCPP_INLINE_VISIBILITY
7171 operator long() const
7172 {return load();}
7173 _LIBCPP_INLINE_VISIBILITY
7174 long exchange(long __v, memory_order __o = memory_order_seq_cst) volatile
7175 {return atomic_exchange_explicit(this, __v, __o);}
7176 _LIBCPP_INLINE_VISIBILITY
7177 long exchange(long __v, memory_order __o = memory_order_seq_cst)
7178 {return atomic_exchange_explicit(this, __v, __o);}
7179 _LIBCPP_INLINE_VISIBILITY
7180 bool compare_exchange_weak(long& __v, long __e, memory_order __s,
7181 memory_order __f) volatile
7182 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
7183 __f);}
7184 _LIBCPP_INLINE_VISIBILITY
7185 bool compare_exchange_weak(long& __v, long __e, memory_order __s,
7186 memory_order __f)
7187 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
7188 __f);}
7189 _LIBCPP_INLINE_VISIBILITY
7190 bool compare_exchange_strong(long& __v, long __e, memory_order __s,
7191 memory_order __f) volatile
7192 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
7193 __f);}
7194 _LIBCPP_INLINE_VISIBILITY
7195 bool compare_exchange_strong(long& __v, long __e, memory_order __s,
7196 memory_order __f)
7197 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
7198 __f);}
7199 _LIBCPP_INLINE_VISIBILITY
7200 bool compare_exchange_weak(long& __v, long __e,
7201 memory_order __s = memory_order_seq_cst) volatile
7202 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
7203 __translate_memory_order(__s));}
7204 _LIBCPP_INLINE_VISIBILITY
7205 bool compare_exchange_weak(long& __v, long __e,
7206 memory_order __s = memory_order_seq_cst)
7207 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
7208 __translate_memory_order(__s));}
7209 _LIBCPP_INLINE_VISIBILITY
7210 bool compare_exchange_strong(long& __v, long __e,
7211 memory_order __s = memory_order_seq_cst) volatile
7212 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
7213 __translate_memory_order(__s));}
7214 _LIBCPP_INLINE_VISIBILITY
7215 bool compare_exchange_strong(long& __v, long __e,
7216 memory_order __s = memory_order_seq_cst)
7217 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
7218 __translate_memory_order(__s));}
7219 _LIBCPP_INLINE_VISIBILITY
7220 long fetch_add(long __v, memory_order __o = memory_order_seq_cst) volatile
7221 {return atomic_fetch_add_explicit(this, __v, __o);}
7222 _LIBCPP_INLINE_VISIBILITY
7223 long fetch_add(long __v, memory_order __o = memory_order_seq_cst)
7224 {return atomic_fetch_add_explicit(this, __v, __o);}
7225 _LIBCPP_INLINE_VISIBILITY
7226 long fetch_sub(long __v, memory_order __o = memory_order_seq_cst) volatile
7227 {return atomic_fetch_sub_explicit(this, __v, __o);}
7228 _LIBCPP_INLINE_VISIBILITY
7229 long fetch_sub(long __v, memory_order __o = memory_order_seq_cst)
7230 {return atomic_fetch_sub_explicit(this, __v, __o);}
7231 _LIBCPP_INLINE_VISIBILITY
7232 long fetch_and(long __v, memory_order __o = memory_order_seq_cst) volatile
7233 {return atomic_fetch_and_explicit(this, __v, __o);}
7234 _LIBCPP_INLINE_VISIBILITY
7235 long fetch_and(long __v, memory_order __o = memory_order_seq_cst)
7236 {return atomic_fetch_and_explicit(this, __v, __o);}
7237 _LIBCPP_INLINE_VISIBILITY
7238 long fetch_or(long __v, memory_order __o = memory_order_seq_cst) volatile
7239 {return atomic_fetch_or_explicit(this, __v, __o);}
7240 _LIBCPP_INLINE_VISIBILITY
7241 long fetch_or(long __v, memory_order __o = memory_order_seq_cst)
7242 {return atomic_fetch_or_explicit(this, __v, __o);}
7243 _LIBCPP_INLINE_VISIBILITY
7244 long fetch_xor(long __v, memory_order __o = memory_order_seq_cst) volatile
7245 {return atomic_fetch_xor_explicit(this, __v, __o);}
7246 _LIBCPP_INLINE_VISIBILITY
7247 long fetch_xor(long __v, memory_order __o = memory_order_seq_cst)
7248 {return atomic_fetch_xor_explicit(this, __v, __o);}
7249#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
7250 atomic_long() = default;
7251#else
7252 _LIBCPP_INLINE_VISIBILITY
7253 atomic_long() {}
7254#endif
7255 _LIBCPP_INLINE_VISIBILITY
7256 /*constexpr*/ atomic_long(long __v)
7257 : __v_(__v) {}
7258#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
7259 atomic_long(const atomic_long&) = delete;
7260 atomic_long& operator=(const atomic_long&) = delete;
7261 atomic_long& operator=(const atomic_long&) volatile = delete;
7262#else
7263private:
7264 atomic_long(const atomic_long&);
7265 atomic_long& operator=(const atomic_long&);
7266 atomic_long& operator=(const atomic_long&) volatile;
7267public:
7268#endif
7269 _LIBCPP_INLINE_VISIBILITY
7270 long operator=(long __v) volatile
7271 {store(__v); return __v;}
7272 _LIBCPP_INLINE_VISIBILITY
7273 long operator=(long __v)
7274 {store(__v); return __v;}
7275 _LIBCPP_INLINE_VISIBILITY
7276 long operator++(int) volatile
7277 {return fetch_add(long(1));}
7278 _LIBCPP_INLINE_VISIBILITY
7279 long operator++(int)
7280 {return fetch_add(long(1));}
7281 _LIBCPP_INLINE_VISIBILITY
7282 long operator--(int) volatile
7283 {return fetch_sub(long(1));}
7284 _LIBCPP_INLINE_VISIBILITY
7285 long operator--(int)
7286 {return fetch_sub(long(1));}
7287 _LIBCPP_INLINE_VISIBILITY
7288 long operator++() volatile
7289 {return long(fetch_add(long(1)) + 1);}
7290 _LIBCPP_INLINE_VISIBILITY
7291 long operator++()
7292 {return long(fetch_add(long(1)) + 1);}
7293 _LIBCPP_INLINE_VISIBILITY
7294 long operator--() volatile
7295 {return long(fetch_sub(long(1)) - 1);}
7296 _LIBCPP_INLINE_VISIBILITY
7297 long operator--()
7298 {return long(fetch_sub(long(1)) - 1);}
7299 _LIBCPP_INLINE_VISIBILITY
7300 long operator+=(long __v) volatile
7301 {return long(fetch_add(__v) + __v);}
7302 _LIBCPP_INLINE_VISIBILITY
7303 long operator+=(long __v)
7304 {return long(fetch_add(__v) + __v);}
7305 _LIBCPP_INLINE_VISIBILITY
7306 long operator-=(long __v) volatile
7307 {return long(fetch_sub(__v) - __v);}
7308 _LIBCPP_INLINE_VISIBILITY
7309 long operator-=(long __v)
7310 {return long(fetch_sub(__v) - __v);}
7311 _LIBCPP_INLINE_VISIBILITY
7312 long operator&=(long __v) volatile
7313 {return long(fetch_and(__v) & __v);}
7314 _LIBCPP_INLINE_VISIBILITY
7315 long operator&=(long __v)
7316 {return long(fetch_and(__v) & __v);}
7317 _LIBCPP_INLINE_VISIBILITY
7318 long operator|=(long __v) volatile
7319 {return long(fetch_or(__v) | __v);}
7320 _LIBCPP_INLINE_VISIBILITY
7321 long operator|=(long __v)
7322 {return long(fetch_or(__v) | __v);}
7323 _LIBCPP_INLINE_VISIBILITY
7324 long operator^=(long __v) volatile
7325 {return long(fetch_xor(__v) ^ __v);}
7326 _LIBCPP_INLINE_VISIBILITY
7327 long operator^=(long __v)
7328 {return long(fetch_xor(__v) ^ __v);}
7329} atomic_long;
7330
7331inline _LIBCPP_INLINE_VISIBILITY
7332bool
7333atomic_is_lock_free(const volatile atomic_long*)
7334{
7335 typedef long type;
7336 return __atomic_is_lock_free(type);
7337}
7338
7339inline _LIBCPP_INLINE_VISIBILITY
7340bool
7341atomic_is_lock_free(const atomic_long* __obj)
7342{
7343 return atomic_is_lock_free(const_cast<volatile atomic_long*>(__obj));
7344}
7345
7346inline _LIBCPP_INLINE_VISIBILITY
7347void
7348atomic_init(volatile atomic_long* __obj, long __desr)
7349{
7350 __obj->__v_ = __desr;
7351}
7352
7353inline _LIBCPP_INLINE_VISIBILITY
7354void
7355atomic_init(atomic_long* __obj, long __desr)
7356{
7357 __obj->__v_ = __desr;
7358}
7359
7360inline _LIBCPP_INLINE_VISIBILITY
7361void
7362atomic_store(volatile atomic_long* __obj, long __desr)
7363{
7364 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
7365}
7366
7367inline _LIBCPP_INLINE_VISIBILITY
7368void
7369atomic_store(atomic_long* __obj, long __desr)
7370{
7371 atomic_store(const_cast<volatile atomic_long*>(__obj), __desr);
7372}
7373
7374inline _LIBCPP_INLINE_VISIBILITY
7375void
7376atomic_store_explicit(volatile atomic_long* __obj, long __desr,
7377 memory_order __o)
7378{
7379 __atomic_store(&__obj->__v_, __desr, __o);
7380}
7381
7382inline _LIBCPP_INLINE_VISIBILITY
7383void
7384atomic_store_explicit(atomic_long* __obj, long __desr, memory_order __o)
7385{
7386 atomic_store_explicit(const_cast<volatile atomic_long*>(__obj), __desr,
7387 __o);
7388}
7389
7390inline _LIBCPP_INLINE_VISIBILITY
7391long
7392atomic_load(const volatile atomic_long* __obj)
7393{
7394 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
7395}
7396
7397inline _LIBCPP_INLINE_VISIBILITY
7398long
7399atomic_load(const atomic_long* __obj)
7400{
7401 return atomic_load(const_cast<const volatile atomic_long*>(__obj));
7402}
7403
7404inline _LIBCPP_INLINE_VISIBILITY
7405long
7406atomic_load_explicit(const volatile atomic_long* __obj, memory_order __o)
7407{
7408 return __atomic_load(&__obj->__v_, __o);
7409}
7410
7411inline _LIBCPP_INLINE_VISIBILITY
7412long
7413atomic_load_explicit(const atomic_long* __obj, memory_order __o)
7414{
7415 return atomic_load_explicit(const_cast<const volatile atomic_long*>
7416 (__obj), __o);
7417}
7418
7419inline _LIBCPP_INLINE_VISIBILITY
7420long
7421atomic_exchange(volatile atomic_long* __obj, long __desr)
7422{
7423 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
7424}
7425
7426inline _LIBCPP_INLINE_VISIBILITY
7427long
7428atomic_exchange(atomic_long* __obj, long __desr)
7429{
7430 return atomic_exchange(const_cast<volatile atomic_long*>(__obj), __desr);
7431}
7432
7433inline _LIBCPP_INLINE_VISIBILITY
7434long
7435atomic_exchange_explicit(volatile atomic_long* __obj, long __desr,
7436 memory_order __o)
7437{
7438 return __atomic_exchange(&__obj->__v_, __desr, __o);
7439}
7440
7441inline _LIBCPP_INLINE_VISIBILITY
7442long
7443atomic_exchange_explicit(atomic_long* __obj, long __desr, memory_order __o)
7444{
7445 return atomic_exchange_explicit(const_cast<volatile atomic_long*>
7446 (__obj), __desr, __o);
7447}
7448
7449inline _LIBCPP_INLINE_VISIBILITY
7450bool
7451atomic_compare_exchange_weak(volatile atomic_long* __obj, long* __exp,
7452 long __desr)
7453{
7454 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
7455 memory_order_seq_cst, memory_order_seq_cst);
7456}
7457
7458inline _LIBCPP_INLINE_VISIBILITY
7459bool
7460atomic_compare_exchange_weak(atomic_long* __obj, long* __exp, long __desr)
7461{
7462 return atomic_compare_exchange_weak(const_cast<volatile atomic_long*>
7463 (__obj), __exp, __desr);
7464}
7465
7466inline _LIBCPP_INLINE_VISIBILITY
7467bool
7468atomic_compare_exchange_strong(volatile atomic_long* __obj, long* __exp,
7469 long __desr)
7470{
7471 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
7472 memory_order_seq_cst, memory_order_seq_cst);
7473}
7474
7475inline _LIBCPP_INLINE_VISIBILITY
7476bool
7477atomic_compare_exchange_strong(atomic_long* __obj, long* __exp, long __desr)
7478{
7479 return atomic_compare_exchange_strong(const_cast<volatile atomic_long*>
7480 (__obj), __exp, __desr);
7481}
7482
7483inline _LIBCPP_INLINE_VISIBILITY
7484bool
7485atomic_compare_exchange_weak_explicit(volatile atomic_long* __obj, long* __exp,
7486 long __desr, memory_order __s,
7487 memory_order __f)
7488{
7489 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
7490 __f);
7491}
7492
7493inline _LIBCPP_INLINE_VISIBILITY
7494bool
7495atomic_compare_exchange_weak_explicit(atomic_long* __obj, long* __exp,
7496 long __desr, memory_order __s,
7497 memory_order __f)
7498{
7499 return atomic_compare_exchange_weak_explicit(
7500 const_cast<volatile atomic_long*>(__obj), __exp, __desr, __s, __f);
7501}
7502
7503inline _LIBCPP_INLINE_VISIBILITY
7504bool
7505atomic_compare_exchange_strong_explicit(volatile atomic_long* __obj,
7506 long* __exp, long __desr,
7507 memory_order __s, memory_order __f)
7508{
7509 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
7510 __f);
7511}
7512
7513inline _LIBCPP_INLINE_VISIBILITY
7514bool
7515atomic_compare_exchange_strong_explicit(atomic_long* __obj, long* __exp,
7516 long __desr, memory_order __s,
7517 memory_order __f)
7518{
7519 return atomic_compare_exchange_strong_explicit(
7520 const_cast<volatile atomic_long*>(__obj), __exp, __desr, __s, __f);
7521}
7522
7523inline _LIBCPP_INLINE_VISIBILITY
7524long
7525atomic_fetch_add(volatile atomic_long* __obj, long __v)
7526{
7527 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
7528}
7529
7530inline _LIBCPP_INLINE_VISIBILITY
7531long
7532atomic_fetch_add(atomic_long* __obj, long __v)
7533{
7534 return atomic_fetch_add(const_cast<volatile atomic_long*>(__obj), __v);
7535}
7536
7537inline _LIBCPP_INLINE_VISIBILITY
7538long
7539atomic_fetch_add_explicit(volatile atomic_long* __obj, long __v,
7540 memory_order __o)
7541{
7542 return __atomic_fetch_add(&__obj->__v_, __v, __o);
7543}
7544
7545inline _LIBCPP_INLINE_VISIBILITY
7546long
7547atomic_fetch_add_explicit(atomic_long* __obj, long __v, memory_order __o)
7548{
7549 return atomic_fetch_add_explicit(const_cast<volatile atomic_long*>(__obj),
7550 __v, __o);
7551}
7552
7553inline _LIBCPP_INLINE_VISIBILITY
7554long
7555atomic_fetch_sub(volatile atomic_long* __obj, long __v)
7556{
7557 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
7558}
7559
7560inline _LIBCPP_INLINE_VISIBILITY
7561long
7562atomic_fetch_sub(atomic_long* __obj, long __v)
7563{
7564 return atomic_fetch_sub(const_cast<volatile atomic_long*>(__obj), __v);
7565}
7566
7567inline _LIBCPP_INLINE_VISIBILITY
7568long
7569atomic_fetch_sub_explicit(volatile atomic_long* __obj, long __v,
7570 memory_order __o)
7571{
7572 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
7573}
7574
7575inline _LIBCPP_INLINE_VISIBILITY
7576long
7577atomic_fetch_sub_explicit(atomic_long* __obj, long __v, memory_order __o)
7578{
7579 return atomic_fetch_sub_explicit(const_cast<volatile atomic_long*>(__obj),
7580 __v, __o);
7581}
7582
7583inline _LIBCPP_INLINE_VISIBILITY
7584long
7585atomic_fetch_and(volatile atomic_long* __obj, long __v)
7586{
7587 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
7588}
7589
7590inline _LIBCPP_INLINE_VISIBILITY
7591long
7592atomic_fetch_and(atomic_long* __obj, long __v)
7593{
7594 return atomic_fetch_and(const_cast<volatile atomic_long*>(__obj), __v);
7595}
7596
7597inline _LIBCPP_INLINE_VISIBILITY
7598long
7599atomic_fetch_and_explicit(volatile atomic_long* __obj, long __v,
7600 memory_order __o)
7601{
7602 return __atomic_fetch_and(&__obj->__v_, __v, __o);
7603}
7604
7605inline _LIBCPP_INLINE_VISIBILITY
7606long
7607atomic_fetch_and_explicit(atomic_long* __obj, long __v, memory_order __o)
7608{
7609 return atomic_fetch_and_explicit(const_cast<volatile atomic_long*>(__obj),
7610 __v, __o);
7611}
7612
7613inline _LIBCPP_INLINE_VISIBILITY
7614long
7615atomic_fetch_or(volatile atomic_long* __obj, long __v)
7616{
7617 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
7618}
7619
7620inline _LIBCPP_INLINE_VISIBILITY
7621long
7622atomic_fetch_or(atomic_long* __obj, long __v)
7623{
7624 return atomic_fetch_or(const_cast<volatile atomic_long*>(__obj), __v);
7625}
7626
7627inline _LIBCPP_INLINE_VISIBILITY
7628long
7629atomic_fetch_or_explicit(volatile atomic_long* __obj, long __v,
7630 memory_order __o)
7631{
7632 return __atomic_fetch_or(&__obj->__v_, __v, __o);
7633}
7634
7635inline _LIBCPP_INLINE_VISIBILITY
7636long
7637atomic_fetch_or_explicit(atomic_long* __obj, long __v, memory_order __o)
7638{
7639 return atomic_fetch_or_explicit(const_cast<volatile atomic_long*>(__obj),
7640 __v, __o);
7641}
7642
7643inline _LIBCPP_INLINE_VISIBILITY
7644long
7645atomic_fetch_xor(volatile atomic_long* __obj, long __v)
7646{
7647 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
7648}
7649
7650inline _LIBCPP_INLINE_VISIBILITY
7651long
7652atomic_fetch_xor(atomic_long* __obj, long __v)
7653{
7654 return atomic_fetch_xor(const_cast<volatile atomic_long*>(__obj), __v);
7655}
7656
7657inline _LIBCPP_INLINE_VISIBILITY
7658long
7659atomic_fetch_xor_explicit(volatile atomic_long* __obj, long __v,
7660 memory_order __o)
7661{
7662 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
7663}
7664
7665inline _LIBCPP_INLINE_VISIBILITY
7666long
7667atomic_fetch_xor_explicit(atomic_long* __obj, long __v, memory_order __o)
7668{
7669 return atomic_fetch_xor_explicit(const_cast<volatile atomic_long*>(__obj),
7670 __v, __o);
7671}
7672
7673// atomic_ulong
7674
7675struct atomic_ulong;
7676
7677bool atomic_is_lock_free(const volatile atomic_ulong*);
7678bool atomic_is_lock_free(const atomic_ulong*);
7679void atomic_init(volatile atomic_ulong*, unsigned long);
7680void atomic_init(atomic_ulong*, unsigned long);
7681void atomic_store(volatile atomic_ulong*, unsigned long);
7682void atomic_store(atomic_ulong*, unsigned long);
7683void atomic_store_explicit(volatile atomic_ulong*, unsigned long, memory_order);
7684void atomic_store_explicit(atomic_ulong*, unsigned long, memory_order);
7685unsigned long atomic_load(const volatile atomic_ulong*);
7686unsigned long atomic_load(const atomic_ulong*);
7687unsigned long atomic_load_explicit(const volatile atomic_ulong*, memory_order);
7688unsigned long atomic_load_explicit(const atomic_ulong*, memory_order);
7689unsigned long atomic_exchange(volatile atomic_ulong*, unsigned long);
7690unsigned long atomic_exchange(atomic_ulong*, unsigned long);
7691unsigned long atomic_exchange_explicit(volatile atomic_ulong*, unsigned long,
7692 memory_order);
7693unsigned long atomic_exchange_explicit(atomic_ulong*, unsigned long,
7694 memory_order);
7695bool atomic_compare_exchange_weak(volatile atomic_ulong*, unsigned long*,
7696 unsigned long);
7697bool atomic_compare_exchange_weak(atomic_ulong*, unsigned long*, unsigned long);
7698bool atomic_compare_exchange_strong(volatile atomic_ulong*, unsigned long*,
7699 unsigned long);
7700bool atomic_compare_exchange_strong(atomic_ulong*, unsigned long*,
7701 unsigned long);
7702bool atomic_compare_exchange_weak_explicit(volatile atomic_ulong*,
7703 unsigned long*, unsigned long,
7704 memory_order, memory_order);
7705bool atomic_compare_exchange_weak_explicit(atomic_ulong*, unsigned long*,
7706 unsigned long, memory_order,
7707 memory_order);
7708bool atomic_compare_exchange_strong_explicit(volatile atomic_ulong*,
7709 unsigned long*, unsigned long,
7710 memory_order, memory_order);
7711bool atomic_compare_exchange_strong_explicit(atomic_ulong*, unsigned long*,
7712 unsigned long, memory_order,
7713 memory_order);
7714unsigned long atomic_fetch_add(volatile atomic_ulong*, unsigned long);
7715unsigned long atomic_fetch_add(atomic_ulong*, unsigned long);
7716unsigned long atomic_fetch_add_explicit(volatile atomic_ulong*, unsigned long,
7717 memory_order);
7718unsigned long atomic_fetch_add_explicit(atomic_ulong*, unsigned long,
7719 memory_order);
7720unsigned long atomic_fetch_sub(volatile atomic_ulong*, unsigned long);
7721unsigned long atomic_fetch_sub(atomic_ulong*, unsigned long);
7722unsigned long atomic_fetch_sub_explicit(volatile atomic_ulong*, unsigned long,
7723 memory_order);
7724unsigned long atomic_fetch_sub_explicit(atomic_ulong*, unsigned long,
7725 memory_order);
7726unsigned long atomic_fetch_and(volatile atomic_ulong*, unsigned long);
7727unsigned long atomic_fetch_and(atomic_ulong*, unsigned long);
7728unsigned long atomic_fetch_and_explicit(volatile atomic_ulong*, unsigned long,
7729 memory_order);
7730unsigned long atomic_fetch_and_explicit(atomic_ulong*, unsigned long,
7731 memory_order);
7732unsigned long atomic_fetch_or(volatile atomic_ulong*, unsigned long);
7733unsigned long atomic_fetch_or(atomic_ulong*, unsigned long);
7734unsigned long atomic_fetch_or_explicit(volatile atomic_ulong*, unsigned long,
7735 memory_order);
7736unsigned long atomic_fetch_or_explicit(atomic_ulong*, unsigned long,
7737 memory_order);
7738unsigned long atomic_fetch_xor(volatile atomic_ulong*, unsigned long);
7739unsigned long atomic_fetch_xor(atomic_ulong*, unsigned long);
7740unsigned long atomic_fetch_xor_explicit(volatile atomic_ulong*, unsigned long,
7741 memory_order);
7742unsigned long atomic_fetch_xor_explicit(atomic_ulong*, unsigned long,
7743 memory_order);
7744
7745typedef struct atomic_ulong
7746{
7747 unsigned long __v_;
7748
7749 _LIBCPP_INLINE_VISIBILITY
7750 bool is_lock_free() const volatile
7751 {return atomic_is_lock_free(this);}
7752 _LIBCPP_INLINE_VISIBILITY
7753 bool is_lock_free() const
7754 {return atomic_is_lock_free(this);}
7755 _LIBCPP_INLINE_VISIBILITY
7756 void store(unsigned long __v,
7757 memory_order __o = memory_order_seq_cst) volatile
7758 {atomic_store_explicit(this, __v, __o);}
7759 _LIBCPP_INLINE_VISIBILITY
7760 void store(unsigned long __v, memory_order __o = memory_order_seq_cst)
7761 {atomic_store_explicit(this, __v, __o);}
7762 _LIBCPP_INLINE_VISIBILITY
7763 unsigned long load(memory_order __o = memory_order_seq_cst) const volatile
7764 {return atomic_load_explicit(this, __o);}
7765 _LIBCPP_INLINE_VISIBILITY
7766 unsigned long load(memory_order __o = memory_order_seq_cst) const
7767 {return atomic_load_explicit(this, __o);}
7768 _LIBCPP_INLINE_VISIBILITY
7769 operator unsigned long() const volatile
7770 {return load();}
7771 _LIBCPP_INLINE_VISIBILITY
7772 operator unsigned long() const
7773 {return load();}
7774 _LIBCPP_INLINE_VISIBILITY
7775 unsigned long exchange(unsigned long __v,
7776 memory_order __o = memory_order_seq_cst) volatile
7777 {return atomic_exchange_explicit(this, __v, __o);}
7778 _LIBCPP_INLINE_VISIBILITY
7779 unsigned long exchange(unsigned long __v,
7780 memory_order __o = memory_order_seq_cst)
7781 {return atomic_exchange_explicit(this, __v, __o);}
7782 _LIBCPP_INLINE_VISIBILITY
7783 bool compare_exchange_weak(unsigned long& __v, unsigned long __e,
7784 memory_order __s, memory_order __f) volatile
7785 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
7786 __f);}
7787 _LIBCPP_INLINE_VISIBILITY
7788 bool compare_exchange_weak(unsigned long& __v, unsigned long __e,
7789 memory_order __s, memory_order __f)
7790 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
7791 __f);}
7792 _LIBCPP_INLINE_VISIBILITY
7793 bool compare_exchange_strong(unsigned long& __v, unsigned long __e,
7794 memory_order __s, memory_order __f) volatile
7795 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
7796 __f);}
7797 _LIBCPP_INLINE_VISIBILITY
7798 bool compare_exchange_strong(unsigned long& __v, unsigned long __e,
7799 memory_order __s, memory_order __f)
7800 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
7801 __f);}
7802 _LIBCPP_INLINE_VISIBILITY
7803 bool compare_exchange_weak(unsigned long& __v, unsigned long __e,
7804 memory_order __s = memory_order_seq_cst) volatile
7805 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
7806 __translate_memory_order(__s));}
7807 _LIBCPP_INLINE_VISIBILITY
7808 bool compare_exchange_weak(unsigned long& __v, unsigned long __e,
7809 memory_order __s = memory_order_seq_cst)
7810 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
7811 __translate_memory_order(__s));}
7812 _LIBCPP_INLINE_VISIBILITY
7813 bool compare_exchange_strong(unsigned long& __v, unsigned long __e,
7814 memory_order __s = memory_order_seq_cst) volatile
7815 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
7816 __translate_memory_order(__s));}
7817 _LIBCPP_INLINE_VISIBILITY
7818 bool compare_exchange_strong(unsigned long& __v, unsigned long __e,
7819 memory_order __s = memory_order_seq_cst)
7820 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
7821 __translate_memory_order(__s));}
7822 _LIBCPP_INLINE_VISIBILITY
7823 unsigned long fetch_add(unsigned long __v,
7824 memory_order __o = memory_order_seq_cst) volatile
7825 {return atomic_fetch_add_explicit(this, __v, __o);}
7826 _LIBCPP_INLINE_VISIBILITY
7827 unsigned long fetch_add(unsigned long __v,
7828 memory_order __o = memory_order_seq_cst)
7829 {return atomic_fetch_add_explicit(this, __v, __o);}
7830 _LIBCPP_INLINE_VISIBILITY
7831 unsigned long fetch_sub(unsigned long __v,
7832 memory_order __o = memory_order_seq_cst) volatile
7833 {return atomic_fetch_sub_explicit(this, __v, __o);}
7834 _LIBCPP_INLINE_VISIBILITY
7835 unsigned long fetch_sub(unsigned long __v,
7836 memory_order __o = memory_order_seq_cst)
7837 {return atomic_fetch_sub_explicit(this, __v, __o);}
7838 _LIBCPP_INLINE_VISIBILITY
7839 unsigned long fetch_and(unsigned long __v,
7840 memory_order __o = memory_order_seq_cst) volatile
7841 {return atomic_fetch_and_explicit(this, __v, __o);}
7842 _LIBCPP_INLINE_VISIBILITY
7843 unsigned long fetch_and(unsigned long __v,
7844 memory_order __o = memory_order_seq_cst)
7845 {return atomic_fetch_and_explicit(this, __v, __o);}
7846 _LIBCPP_INLINE_VISIBILITY
7847 unsigned long fetch_or(unsigned long __v,
7848 memory_order __o = memory_order_seq_cst) volatile
7849 {return atomic_fetch_or_explicit(this, __v, __o);}
7850 _LIBCPP_INLINE_VISIBILITY
7851 unsigned long fetch_or(unsigned long __v,
7852 memory_order __o = memory_order_seq_cst)
7853 {return atomic_fetch_or_explicit(this, __v, __o);}
7854 _LIBCPP_INLINE_VISIBILITY
7855 unsigned long fetch_xor(unsigned long __v,
7856 memory_order __o = memory_order_seq_cst) volatile
7857 {return atomic_fetch_xor_explicit(this, __v, __o);}
7858 _LIBCPP_INLINE_VISIBILITY
7859 unsigned long fetch_xor(unsigned long __v,
7860 memory_order __o = memory_order_seq_cst)
7861 {return atomic_fetch_xor_explicit(this, __v, __o);}
7862#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
7863 atomic_ulong() = default;
7864#else
7865 _LIBCPP_INLINE_VISIBILITY
7866 atomic_ulong() {}
7867#endif
7868 _LIBCPP_INLINE_VISIBILITY
7869 /*constexpr*/ atomic_ulong(unsigned long __v)
7870 : __v_(__v) {}
7871#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
7872 atomic_ulong(const atomic_ulong&) = delete;
7873 atomic_ulong& operator=(const atomic_ulong&) = delete;
7874 atomic_ulong& operator=(const atomic_ulong&) volatile = delete;
7875#else
7876private:
7877 atomic_ulong(const atomic_ulong&);
7878 atomic_ulong& operator=(const atomic_ulong&);
7879 atomic_ulong& operator=(const atomic_ulong&) volatile;
7880public:
7881#endif
7882 _LIBCPP_INLINE_VISIBILITY
7883 unsigned long operator=(unsigned long __v) volatile
7884 {store(__v); return __v;}
7885 _LIBCPP_INLINE_VISIBILITY
7886 unsigned long operator=(unsigned long __v)
7887 {store(__v); return __v;}
7888 _LIBCPP_INLINE_VISIBILITY
7889 unsigned long operator++(int) volatile
7890 {typedef unsigned long type; return fetch_add(type(1));}
7891 _LIBCPP_INLINE_VISIBILITY
7892 long operator++(int)
7893 {typedef unsigned long type; return fetch_add(type(1));}
7894 _LIBCPP_INLINE_VISIBILITY
7895 long operator--(int) volatile
7896 {typedef unsigned long type; return fetch_sub(type(1));}
7897 _LIBCPP_INLINE_VISIBILITY
7898 long operator--(int)
7899 {typedef unsigned long type; return fetch_sub(type(1));}
7900 _LIBCPP_INLINE_VISIBILITY
7901 long operator++() volatile
7902 {typedef unsigned long type; return type(fetch_add(type(1)) + 1);}
7903 _LIBCPP_INLINE_VISIBILITY
7904 long operator++()
7905 {typedef unsigned long type; return type(fetch_add(type(1)) + 1);}
7906 _LIBCPP_INLINE_VISIBILITY
7907 long operator--() volatile
7908 {typedef unsigned long type; return type(fetch_sub(type(1)) - 1);}
7909 _LIBCPP_INLINE_VISIBILITY
7910 long operator--()
7911 {typedef unsigned long type; return type(fetch_sub(type(1)) - 1);}
7912 _LIBCPP_INLINE_VISIBILITY
7913 long operator+=(long __v) volatile
7914 {typedef unsigned long type; return type(fetch_add(__v) + __v);}
7915 _LIBCPP_INLINE_VISIBILITY
7916 long operator+=(long __v)
7917 {typedef unsigned long type; return type(fetch_add(__v) + __v);}
7918 _LIBCPP_INLINE_VISIBILITY
7919 long operator-=(long __v) volatile
7920 {typedef unsigned long type; return type(fetch_sub(__v) - __v);}
7921 _LIBCPP_INLINE_VISIBILITY
7922 long operator-=(long __v)
7923 {typedef unsigned long type; return type(fetch_sub(__v) - __v);}
7924 _LIBCPP_INLINE_VISIBILITY
7925 long operator&=(long __v) volatile
7926 {typedef unsigned long type; return type(fetch_and(__v) & __v);}
7927 _LIBCPP_INLINE_VISIBILITY
7928 long operator&=(long __v)
7929 {typedef unsigned long type; return type(fetch_and(__v) & __v);}
7930 _LIBCPP_INLINE_VISIBILITY
7931 long operator|=(long __v) volatile
7932 {typedef unsigned long type; return type(fetch_or(__v) | __v);}
7933 _LIBCPP_INLINE_VISIBILITY
7934 long operator|=(long __v)
7935 {typedef unsigned long type; return type(fetch_or(__v) | __v);}
7936 _LIBCPP_INLINE_VISIBILITY
7937 long operator^=(long __v) volatile
7938 {typedef unsigned long type; return type(fetch_xor(__v) ^ __v);}
7939 _LIBCPP_INLINE_VISIBILITY
7940 long operator^=(long __v)
7941 {typedef unsigned long type; return type(fetch_xor(__v) ^ __v);}
7942} atomic_ulong;
7943
7944inline _LIBCPP_INLINE_VISIBILITY
7945bool
7946atomic_is_lock_free(const volatile atomic_ulong*)
7947{
7948 typedef unsigned long type;
7949 return __atomic_is_lock_free(type);
7950}
7951
7952inline _LIBCPP_INLINE_VISIBILITY
7953bool
7954atomic_is_lock_free(const atomic_ulong* __obj)
7955{
7956 return atomic_is_lock_free(const_cast<volatile atomic_ulong*>(__obj));
7957}
7958
7959inline _LIBCPP_INLINE_VISIBILITY
7960void
7961atomic_init(volatile atomic_ulong* __obj, unsigned long __desr)
7962{
7963 __obj->__v_ = __desr;
7964}
7965
7966inline _LIBCPP_INLINE_VISIBILITY
7967void
7968atomic_init(atomic_ulong* __obj, unsigned long __desr)
7969{
7970 __obj->__v_ = __desr;
7971}
7972
7973inline _LIBCPP_INLINE_VISIBILITY
7974void
7975atomic_store(volatile atomic_ulong* __obj, unsigned long __desr)
7976{
7977 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
7978}
7979
7980inline _LIBCPP_INLINE_VISIBILITY
7981void
7982atomic_store(atomic_ulong* __obj, unsigned long __desr)
7983{
7984 atomic_store(const_cast<volatile atomic_ulong*>(__obj), __desr);
7985}
7986
7987inline _LIBCPP_INLINE_VISIBILITY
7988void
7989atomic_store_explicit(volatile atomic_ulong* __obj, unsigned long __desr,
7990 memory_order __o)
7991{
7992 __atomic_store(&__obj->__v_, __desr, __o);
7993}
7994
7995inline _LIBCPP_INLINE_VISIBILITY
7996void
7997atomic_store_explicit(atomic_ulong* __obj, unsigned long __desr,
7998 memory_order __o)
7999{
8000 atomic_store_explicit(const_cast<volatile atomic_ulong*>(__obj), __desr,
8001 __o);
8002}
8003
8004inline _LIBCPP_INLINE_VISIBILITY
8005unsigned long
8006atomic_load(const volatile atomic_ulong* __obj)
8007{
8008 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
8009}
8010
8011inline _LIBCPP_INLINE_VISIBILITY
8012unsigned long
8013atomic_load(const atomic_ulong* __obj)
8014{
8015 return atomic_load(const_cast<const volatile atomic_ulong*>(__obj));
8016}
8017
8018inline _LIBCPP_INLINE_VISIBILITY
8019unsigned long
8020atomic_load_explicit(const volatile atomic_ulong* __obj, memory_order __o)
8021{
8022 return __atomic_load(&__obj->__v_, __o);
8023}
8024
8025inline _LIBCPP_INLINE_VISIBILITY
8026unsigned long
8027atomic_load_explicit(const atomic_ulong* __obj, memory_order __o)
8028{
8029 return atomic_load_explicit(const_cast<const volatile atomic_ulong*>
8030 (__obj), __o);
8031}
8032
8033inline _LIBCPP_INLINE_VISIBILITY
8034unsigned long
8035atomic_exchange(volatile atomic_ulong* __obj, unsigned long __desr)
8036{
8037 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
8038}
8039
8040inline _LIBCPP_INLINE_VISIBILITY
8041unsigned long
8042atomic_exchange(atomic_ulong* __obj, unsigned long __desr)
8043{
8044 return atomic_exchange(const_cast<volatile atomic_ulong*>(__obj), __desr);
8045}
8046
8047inline _LIBCPP_INLINE_VISIBILITY
8048unsigned long
8049atomic_exchange_explicit(volatile atomic_ulong* __obj, unsigned long __desr,
8050 memory_order __o)
8051{
8052 return __atomic_exchange(&__obj->__v_, __desr, __o);
8053}
8054
8055inline _LIBCPP_INLINE_VISIBILITY
8056unsigned long
8057atomic_exchange_explicit(atomic_ulong* __obj, unsigned long __desr,
8058 memory_order __o)
8059{
8060 return atomic_exchange_explicit(const_cast<volatile atomic_ulong*>
8061 (__obj), __desr, __o);
8062}
8063
8064inline _LIBCPP_INLINE_VISIBILITY
8065bool
8066atomic_compare_exchange_weak(volatile atomic_ulong* __obj, unsigned long* __exp,
8067 unsigned long __desr)
8068{
8069 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
8070 memory_order_seq_cst, memory_order_seq_cst);
8071}
8072
8073inline _LIBCPP_INLINE_VISIBILITY
8074bool
8075atomic_compare_exchange_weak(atomic_ulong* __obj, unsigned long* __exp,
8076 unsigned long __desr)
8077{
8078 return atomic_compare_exchange_weak(const_cast<volatile atomic_ulong*>
8079 (__obj), __exp, __desr);
8080}
8081
8082inline _LIBCPP_INLINE_VISIBILITY
8083bool
8084atomic_compare_exchange_strong(volatile atomic_ulong* __obj,
8085 unsigned long* __exp, unsigned long __desr)
8086{
8087 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
8088 memory_order_seq_cst, memory_order_seq_cst);
8089}
8090
8091inline _LIBCPP_INLINE_VISIBILITY
8092bool
8093atomic_compare_exchange_strong(atomic_ulong* __obj, unsigned long* __exp,
8094 unsigned long __desr)
8095{
8096 return atomic_compare_exchange_strong(const_cast<volatile atomic_ulong*>
8097 (__obj), __exp, __desr);
8098}
8099
8100inline _LIBCPP_INLINE_VISIBILITY
8101bool
8102atomic_compare_exchange_weak_explicit(volatile atomic_ulong* __obj,
8103 unsigned long* __exp,
8104 unsigned long __desr, memory_order __s,
8105 memory_order __f)
8106{
8107 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
8108 __f);
8109}
8110
8111inline _LIBCPP_INLINE_VISIBILITY
8112bool
8113atomic_compare_exchange_weak_explicit(atomic_ulong* __obj, unsigned long* __exp,
8114 unsigned long __desr, memory_order __s,
8115 memory_order __f)
8116{
8117 return atomic_compare_exchange_weak_explicit(
8118 const_cast<volatile atomic_ulong*>(__obj), __exp, __desr, __s, __f);
8119}
8120
8121inline _LIBCPP_INLINE_VISIBILITY
8122bool
8123atomic_compare_exchange_strong_explicit(volatile atomic_ulong* __obj,
8124 unsigned long* __exp,
8125 unsigned long __desr, memory_order __s,
8126 memory_order __f)
8127{
8128 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
8129 __f);
8130}
8131
8132inline _LIBCPP_INLINE_VISIBILITY
8133bool
8134atomic_compare_exchange_strong_explicit(atomic_ulong* __obj,
8135 unsigned long* __exp,
8136 unsigned long __desr, memory_order __s,
8137 memory_order __f)
8138{
8139 return atomic_compare_exchange_strong_explicit(
8140 const_cast<volatile atomic_ulong*>(__obj), __exp, __desr, __s, __f);
8141}
8142
8143inline _LIBCPP_INLINE_VISIBILITY
8144unsigned long
8145atomic_fetch_add(volatile atomic_ulong* __obj, unsigned long __v)
8146{
8147 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
8148}
8149
8150inline _LIBCPP_INLINE_VISIBILITY
8151unsigned long
8152atomic_fetch_add(atomic_ulong* __obj, unsigned long __v)
8153{
8154 return atomic_fetch_add(const_cast<volatile atomic_ulong*>(__obj), __v);
8155}
8156
8157inline _LIBCPP_INLINE_VISIBILITY
8158unsigned long
8159atomic_fetch_add_explicit(volatile atomic_ulong* __obj, unsigned long __v,
8160 memory_order __o)
8161{
8162 return __atomic_fetch_add(&__obj->__v_, __v, __o);
8163}
8164
8165inline _LIBCPP_INLINE_VISIBILITY
8166unsigned long
8167atomic_fetch_add_explicit(atomic_ulong* __obj, unsigned long __v,
8168 memory_order __o)
8169{
8170 return atomic_fetch_add_explicit(const_cast<volatile atomic_ulong*>(__obj),
8171 __v, __o);
8172}
8173
8174inline _LIBCPP_INLINE_VISIBILITY
8175unsigned long
8176atomic_fetch_sub(volatile atomic_ulong* __obj, unsigned long __v)
8177{
8178 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
8179}
8180
8181inline _LIBCPP_INLINE_VISIBILITY
8182unsigned long
8183atomic_fetch_sub(atomic_ulong* __obj, unsigned long __v)
8184{
8185 return atomic_fetch_sub(const_cast<volatile atomic_ulong*>(__obj), __v);
8186}
8187
8188inline _LIBCPP_INLINE_VISIBILITY
8189unsigned long
8190atomic_fetch_sub_explicit(volatile atomic_ulong* __obj, unsigned long __v,
8191 memory_order __o)
8192{
8193 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
8194}
8195
8196inline _LIBCPP_INLINE_VISIBILITY
8197unsigned long
8198atomic_fetch_sub_explicit(atomic_ulong* __obj, unsigned long __v,
8199 memory_order __o)
8200{
8201 return atomic_fetch_sub_explicit(const_cast<volatile atomic_ulong*>(__obj),
8202 __v, __o);
8203}
8204
8205inline _LIBCPP_INLINE_VISIBILITY
8206unsigned long
8207atomic_fetch_and(volatile atomic_ulong* __obj, unsigned long __v)
8208{
8209 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
8210}
8211
8212inline _LIBCPP_INLINE_VISIBILITY
8213unsigned long
8214atomic_fetch_and(atomic_ulong* __obj, unsigned long __v)
8215{
8216 return atomic_fetch_and(const_cast<volatile atomic_ulong*>(__obj), __v);
8217}
8218
8219inline _LIBCPP_INLINE_VISIBILITY
8220unsigned long
8221atomic_fetch_and_explicit(volatile atomic_ulong* __obj, unsigned long __v,
8222 memory_order __o)
8223{
8224 return __atomic_fetch_and(&__obj->__v_, __v, __o);
8225}
8226
8227inline _LIBCPP_INLINE_VISIBILITY
8228unsigned long
8229atomic_fetch_and_explicit(atomic_ulong* __obj, unsigned long __v,
8230 memory_order __o)
8231{
8232 return atomic_fetch_and_explicit(const_cast<volatile atomic_ulong*>(__obj),
8233 __v, __o);
8234}
8235
8236inline _LIBCPP_INLINE_VISIBILITY
8237unsigned long
8238atomic_fetch_or(volatile atomic_ulong* __obj, unsigned long __v)
8239{
8240 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
8241}
8242
8243inline _LIBCPP_INLINE_VISIBILITY
8244unsigned long
8245atomic_fetch_or(atomic_ulong* __obj, unsigned long __v)
8246{
8247 return atomic_fetch_or(const_cast<volatile atomic_ulong*>(__obj), __v);
8248}
8249
8250inline _LIBCPP_INLINE_VISIBILITY
8251unsigned long
8252atomic_fetch_or_explicit(volatile atomic_ulong* __obj, unsigned long __v,
8253 memory_order __o)
8254{
8255 return __atomic_fetch_or(&__obj->__v_, __v, __o);
8256}
8257
8258inline _LIBCPP_INLINE_VISIBILITY
8259unsigned long
8260atomic_fetch_or_explicit(atomic_ulong* __obj, unsigned long __v,
8261 memory_order __o)
8262{
8263 return atomic_fetch_or_explicit(const_cast<volatile atomic_ulong*>(__obj),
8264 __v, __o);
8265}
8266
8267inline _LIBCPP_INLINE_VISIBILITY
8268unsigned long
8269atomic_fetch_xor(volatile atomic_ulong* __obj, unsigned long __v)
8270{
8271 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
8272}
8273
8274inline _LIBCPP_INLINE_VISIBILITY
8275unsigned long
8276atomic_fetch_xor(atomic_ulong* __obj, unsigned long __v)
8277{
8278 return atomic_fetch_xor(const_cast<volatile atomic_ulong*>(__obj), __v);
8279}
8280
8281inline _LIBCPP_INLINE_VISIBILITY
8282unsigned long
8283atomic_fetch_xor_explicit(volatile atomic_ulong* __obj, unsigned long __v,
8284 memory_order __o)
8285{
8286 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
8287}
8288
8289inline _LIBCPP_INLINE_VISIBILITY
8290unsigned long
8291atomic_fetch_xor_explicit(atomic_ulong* __obj, unsigned long __v,
8292 memory_order __o)
8293{
8294 return atomic_fetch_xor_explicit(const_cast<volatile atomic_ulong*>(__obj),
8295 __v, __o);
8296}
8297
8298// atomic_llong
8299
8300struct atomic_llong;
8301
8302bool atomic_is_lock_free(const volatile atomic_llong*);
8303bool atomic_is_lock_free(const atomic_llong*);
8304void atomic_init(volatile atomic_llong*, long long);
8305void atomic_init(atomic_llong*, long long);
8306void atomic_store(volatile atomic_llong*, long long);
8307void atomic_store(atomic_llong*, long long);
8308void atomic_store_explicit(volatile atomic_llong*, long long, memory_order);
8309void atomic_store_explicit(atomic_llong*, long long, memory_order);
8310long long atomic_load(const volatile atomic_llong*);
8311long long atomic_load(const atomic_llong*);
8312long long atomic_load_explicit(const volatile atomic_llong*, memory_order);
8313long long atomic_load_explicit(const atomic_llong*, memory_order);
8314long long atomic_exchange(volatile atomic_llong*, long long);
8315long long atomic_exchange(atomic_llong*, long long);
8316long long atomic_exchange_explicit(volatile atomic_llong*, long long,
8317 memory_order);
8318long long atomic_exchange_explicit(atomic_llong*, long long,
8319 memory_order);
8320bool atomic_compare_exchange_weak(volatile atomic_llong*, long long*,
8321 long long);
8322bool atomic_compare_exchange_weak(atomic_llong*, long long*, long long);
8323bool atomic_compare_exchange_strong(volatile atomic_llong*, long long*,
8324 long long);
8325bool atomic_compare_exchange_strong(atomic_llong*, long long*,
8326 long long);
8327bool atomic_compare_exchange_weak_explicit(volatile atomic_llong*,
8328 long long*, long long,
8329 memory_order, memory_order);
8330bool atomic_compare_exchange_weak_explicit(atomic_llong*, long long*,
8331 long long, memory_order,
8332 memory_order);
8333bool atomic_compare_exchange_strong_explicit(volatile atomic_llong*,
8334 long long*, long long,
8335 memory_order, memory_order);
8336bool atomic_compare_exchange_strong_explicit(atomic_llong*, long long*,
8337 long long, memory_order,
8338 memory_order);
8339long long atomic_fetch_add(volatile atomic_llong*, long long);
8340long long atomic_fetch_add(atomic_llong*, long long);
8341long long atomic_fetch_add_explicit(volatile atomic_llong*, long long,
8342 memory_order);
8343long long atomic_fetch_add_explicit(atomic_llong*, long long,
8344 memory_order);
8345long long atomic_fetch_sub(volatile atomic_llong*, long long);
8346long long atomic_fetch_sub(atomic_llong*, long long);
8347long long atomic_fetch_sub_explicit(volatile atomic_llong*, long long,
8348 memory_order);
8349long long atomic_fetch_sub_explicit(atomic_llong*, long long,
8350 memory_order);
8351long long atomic_fetch_and(volatile atomic_llong*, long long);
8352long long atomic_fetch_and(atomic_llong*, long long);
8353long long atomic_fetch_and_explicit(volatile atomic_llong*, long long,
8354 memory_order);
8355long long atomic_fetch_and_explicit(atomic_llong*, long long,
8356 memory_order);
8357long long atomic_fetch_or(volatile atomic_llong*, long long);
8358long long atomic_fetch_or(atomic_llong*, long long);
8359long long atomic_fetch_or_explicit(volatile atomic_llong*, long long,
8360 memory_order);
8361long long atomic_fetch_or_explicit(atomic_llong*, long long,
8362 memory_order);
8363long long atomic_fetch_xor(volatile atomic_llong*, long long);
8364long long atomic_fetch_xor(atomic_llong*, long long);
8365long long atomic_fetch_xor_explicit(volatile atomic_llong*, long long,
8366 memory_order);
8367long long atomic_fetch_xor_explicit(atomic_llong*, long long,
8368 memory_order);
8369
8370typedef struct atomic_llong
8371{
8372 long long __v_;
8373
8374 _LIBCPP_INLINE_VISIBILITY
8375 bool is_lock_free() const volatile
8376 {return atomic_is_lock_free(this);}
8377 _LIBCPP_INLINE_VISIBILITY
8378 bool is_lock_free() const
8379 {return atomic_is_lock_free(this);}
8380 _LIBCPP_INLINE_VISIBILITY
8381 void store(long long __v,
8382 memory_order __o = memory_order_seq_cst) volatile
8383 {atomic_store_explicit(this, __v, __o);}
8384 _LIBCPP_INLINE_VISIBILITY
8385 void store(long long __v, memory_order __o = memory_order_seq_cst)
8386 {atomic_store_explicit(this, __v, __o);}
8387 _LIBCPP_INLINE_VISIBILITY
8388 long long load(memory_order __o = memory_order_seq_cst) const volatile
8389 {return atomic_load_explicit(this, __o);}
8390 _LIBCPP_INLINE_VISIBILITY
8391 long long load(memory_order __o = memory_order_seq_cst) const
8392 {return atomic_load_explicit(this, __o);}
8393 _LIBCPP_INLINE_VISIBILITY
8394 operator long long() const volatile
8395 {return load();}
8396 _LIBCPP_INLINE_VISIBILITY
8397 operator long long() const
8398 {return load();}
8399 _LIBCPP_INLINE_VISIBILITY
8400 long long exchange(long long __v,
8401 memory_order __o = memory_order_seq_cst) volatile
8402 {return atomic_exchange_explicit(this, __v, __o);}
8403 _LIBCPP_INLINE_VISIBILITY
8404 long long exchange(long long __v,
8405 memory_order __o = memory_order_seq_cst)
8406 {return atomic_exchange_explicit(this, __v, __o);}
8407 _LIBCPP_INLINE_VISIBILITY
8408 bool compare_exchange_weak(long long& __v, long long __e,
8409 memory_order __s, memory_order __f) volatile
8410 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
8411 __f);}
8412 _LIBCPP_INLINE_VISIBILITY
8413 bool compare_exchange_weak(long long& __v, long long __e,
8414 memory_order __s, memory_order __f)
8415 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
8416 __f);}
8417 _LIBCPP_INLINE_VISIBILITY
8418 bool compare_exchange_strong(long long& __v, long long __e,
8419 memory_order __s, memory_order __f) volatile
8420 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
8421 __f);}
8422 _LIBCPP_INLINE_VISIBILITY
8423 bool compare_exchange_strong(long long& __v, long long __e,
8424 memory_order __s, memory_order __f)
8425 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
8426 __f);}
8427 _LIBCPP_INLINE_VISIBILITY
8428 bool compare_exchange_weak(long long& __v, long long __e,
8429 memory_order __s = memory_order_seq_cst) volatile
8430 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
8431 __translate_memory_order(__s));}
8432 _LIBCPP_INLINE_VISIBILITY
8433 bool compare_exchange_weak(long long& __v, long long __e,
8434 memory_order __s = memory_order_seq_cst)
8435 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
8436 __translate_memory_order(__s));}
8437 _LIBCPP_INLINE_VISIBILITY
8438 bool compare_exchange_strong(long long& __v, long long __e,
8439 memory_order __s = memory_order_seq_cst) volatile
8440 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
8441 __translate_memory_order(__s));}
8442 _LIBCPP_INLINE_VISIBILITY
8443 bool compare_exchange_strong(long long& __v, long long __e,
8444 memory_order __s = memory_order_seq_cst)
8445 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
8446 __translate_memory_order(__s));}
8447 _LIBCPP_INLINE_VISIBILITY
8448 long long fetch_add(long long __v,
8449 memory_order __o = memory_order_seq_cst) volatile
8450 {return atomic_fetch_add_explicit(this, __v, __o);}
8451 _LIBCPP_INLINE_VISIBILITY
8452 long long fetch_add(long long __v,
8453 memory_order __o = memory_order_seq_cst)
8454 {return atomic_fetch_add_explicit(this, __v, __o);}
8455 _LIBCPP_INLINE_VISIBILITY
8456 long long fetch_sub(long long __v,
8457 memory_order __o = memory_order_seq_cst) volatile
8458 {return atomic_fetch_sub_explicit(this, __v, __o);}
8459 _LIBCPP_INLINE_VISIBILITY
8460 long long fetch_sub(long long __v,
8461 memory_order __o = memory_order_seq_cst)
8462 {return atomic_fetch_sub_explicit(this, __v, __o);}
8463 _LIBCPP_INLINE_VISIBILITY
8464 long long fetch_and(long long __v,
8465 memory_order __o = memory_order_seq_cst) volatile
8466 {return atomic_fetch_and_explicit(this, __v, __o);}
8467 _LIBCPP_INLINE_VISIBILITY
8468 long long fetch_and(long long __v,
8469 memory_order __o = memory_order_seq_cst)
8470 {return atomic_fetch_and_explicit(this, __v, __o);}
8471 _LIBCPP_INLINE_VISIBILITY
8472 long long fetch_or(long long __v,
8473 memory_order __o = memory_order_seq_cst) volatile
8474 {return atomic_fetch_or_explicit(this, __v, __o);}
8475 _LIBCPP_INLINE_VISIBILITY
8476 long long fetch_or(long long __v,
8477 memory_order __o = memory_order_seq_cst)
8478 {return atomic_fetch_or_explicit(this, __v, __o);}
8479 _LIBCPP_INLINE_VISIBILITY
8480 long long fetch_xor(long long __v,
8481 memory_order __o = memory_order_seq_cst) volatile
8482 {return atomic_fetch_xor_explicit(this, __v, __o);}
8483 _LIBCPP_INLINE_VISIBILITY
8484 long long fetch_xor(long long __v,
8485 memory_order __o = memory_order_seq_cst)
8486 {return atomic_fetch_xor_explicit(this, __v, __o);}
8487#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
8488 atomic_llong() = default;
8489#else
8490 _LIBCPP_INLINE_VISIBILITY
8491 atomic_llong() {}
8492#endif
8493 _LIBCPP_INLINE_VISIBILITY
8494 /*constexpr*/ atomic_llong(long long __v)
8495 : __v_(__v) {}
8496#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
8497 atomic_llong(const atomic_llong&) = delete;
8498 atomic_llong& operator=(const atomic_llong&) = delete;
8499 atomic_llong& operator=(const atomic_llong&) volatile = delete;
8500#else
8501private:
8502 atomic_llong(const atomic_llong&);
8503 atomic_llong& operator=(const atomic_llong&);
8504 atomic_llong& operator=(const atomic_llong&) volatile;
8505public:
8506#endif
8507 _LIBCPP_INLINE_VISIBILITY
8508 long long operator=(long long __v) volatile
8509 {store(__v); return __v;}
8510 _LIBCPP_INLINE_VISIBILITY
8511 long long operator=(long long __v)
8512 {store(__v); return __v;}
8513 _LIBCPP_INLINE_VISIBILITY
8514 long long operator++(int) volatile
8515 {typedef long long type; return fetch_add(type(1));}
8516 _LIBCPP_INLINE_VISIBILITY
8517 long operator++(int)
8518 {typedef long long type; return fetch_add(type(1));}
8519 _LIBCPP_INLINE_VISIBILITY
8520 long operator--(int) volatile
8521 {typedef long long type; return fetch_sub(type(1));}
8522 _LIBCPP_INLINE_VISIBILITY
8523 long operator--(int)
8524 {typedef long long type; return fetch_sub(type(1));}
8525 _LIBCPP_INLINE_VISIBILITY
8526 long operator++() volatile
8527 {typedef long long type; return type(fetch_add(type(1)) + 1);}
8528 _LIBCPP_INLINE_VISIBILITY
8529 long operator++()
8530 {typedef long long type; return type(fetch_add(type(1)) + 1);}
8531 _LIBCPP_INLINE_VISIBILITY
8532 long operator--() volatile
8533 {typedef long long type; return type(fetch_sub(type(1)) - 1);}
8534 _LIBCPP_INLINE_VISIBILITY
8535 long operator--()
8536 {typedef long long type; return type(fetch_sub(type(1)) - 1);}
8537 _LIBCPP_INLINE_VISIBILITY
8538 long operator+=(long __v) volatile
8539 {typedef long long type; return type(fetch_add(__v) + __v);}
8540 _LIBCPP_INLINE_VISIBILITY
8541 long operator+=(long __v)
8542 {typedef long long type; return type(fetch_add(__v) + __v);}
8543 _LIBCPP_INLINE_VISIBILITY
8544 long operator-=(long __v) volatile
8545 {typedef long long type; return type(fetch_sub(__v) - __v);}
8546 _LIBCPP_INLINE_VISIBILITY
8547 long operator-=(long __v)
8548 {typedef long long type; return type(fetch_sub(__v) - __v);}
8549 _LIBCPP_INLINE_VISIBILITY
8550 long operator&=(long __v) volatile
8551 {typedef long long type; return type(fetch_and(__v) & __v);}
8552 _LIBCPP_INLINE_VISIBILITY
8553 long operator&=(long __v)
8554 {typedef long long type; return type(fetch_and(__v) & __v);}
8555 _LIBCPP_INLINE_VISIBILITY
8556 long operator|=(long __v) volatile
8557 {typedef long long type; return type(fetch_or(__v) | __v);}
8558 _LIBCPP_INLINE_VISIBILITY
8559 long operator|=(long __v)
8560 {typedef long long type; return type(fetch_or(__v) | __v);}
8561 _LIBCPP_INLINE_VISIBILITY
8562 long operator^=(long __v) volatile
8563 {typedef long long type; return type(fetch_xor(__v) ^ __v);}
8564 _LIBCPP_INLINE_VISIBILITY
8565 long operator^=(long __v)
8566 {typedef long long type; return type(fetch_xor(__v) ^ __v);}
8567} atomic_llong;
8568
8569inline _LIBCPP_INLINE_VISIBILITY
8570bool
8571atomic_is_lock_free(const volatile atomic_llong*)
8572{
8573 typedef long long type;
8574 return __atomic_is_lock_free(type);
8575}
8576
8577inline _LIBCPP_INLINE_VISIBILITY
8578bool
8579atomic_is_lock_free(const atomic_llong* __obj)
8580{
8581 return atomic_is_lock_free(const_cast<volatile atomic_llong*>(__obj));
8582}
8583
8584inline _LIBCPP_INLINE_VISIBILITY
8585void
8586atomic_init(volatile atomic_llong* __obj, long long __desr)
8587{
8588 __obj->__v_ = __desr;
8589}
8590
8591inline _LIBCPP_INLINE_VISIBILITY
8592void
8593atomic_init(atomic_llong* __obj, long long __desr)
8594{
8595 __obj->__v_ = __desr;
8596}
8597
8598inline _LIBCPP_INLINE_VISIBILITY
8599void
8600atomic_store(volatile atomic_llong* __obj, long long __desr)
8601{
8602 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
8603}
8604
8605inline _LIBCPP_INLINE_VISIBILITY
8606void
8607atomic_store(atomic_llong* __obj, long long __desr)
8608{
8609 atomic_store(const_cast<volatile atomic_llong*>(__obj), __desr);
8610}
8611
8612inline _LIBCPP_INLINE_VISIBILITY
8613void
8614atomic_store_explicit(volatile atomic_llong* __obj, long long __desr,
8615 memory_order __o)
8616{
8617 __atomic_store(&__obj->__v_, __desr, __o);
8618}
8619
8620inline _LIBCPP_INLINE_VISIBILITY
8621void
8622atomic_store_explicit(atomic_llong* __obj, long long __desr,
8623 memory_order __o)
8624{
8625 atomic_store_explicit(const_cast<volatile atomic_llong*>(__obj), __desr,
8626 __o);
8627}
8628
8629inline _LIBCPP_INLINE_VISIBILITY
8630long long
8631atomic_load(const volatile atomic_llong* __obj)
8632{
8633 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
8634}
8635
8636inline _LIBCPP_INLINE_VISIBILITY
8637long long
8638atomic_load(const atomic_llong* __obj)
8639{
8640 return atomic_load(const_cast<const volatile atomic_llong*>(__obj));
8641}
8642
8643inline _LIBCPP_INLINE_VISIBILITY
8644long long
8645atomic_load_explicit(const volatile atomic_llong* __obj, memory_order __o)
8646{
8647 return __atomic_load(&__obj->__v_, __o);
8648}
8649
8650inline _LIBCPP_INLINE_VISIBILITY
8651long long
8652atomic_load_explicit(const atomic_llong* __obj, memory_order __o)
8653{
8654 return atomic_load_explicit(const_cast<const volatile atomic_llong*>
8655 (__obj), __o);
8656}
8657
8658inline _LIBCPP_INLINE_VISIBILITY
8659long long
8660atomic_exchange(volatile atomic_llong* __obj, long long __desr)
8661{
8662 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
8663}
8664
8665inline _LIBCPP_INLINE_VISIBILITY
8666long long
8667atomic_exchange(atomic_llong* __obj, long long __desr)
8668{
8669 return atomic_exchange(const_cast<volatile atomic_llong*>(__obj), __desr);
8670}
8671
8672inline _LIBCPP_INLINE_VISIBILITY
8673long long
8674atomic_exchange_explicit(volatile atomic_llong* __obj, long long __desr,
8675 memory_order __o)
8676{
8677 return __atomic_exchange(&__obj->__v_, __desr, __o);
8678}
8679
8680inline _LIBCPP_INLINE_VISIBILITY
8681long long
8682atomic_exchange_explicit(atomic_llong* __obj, long long __desr,
8683 memory_order __o)
8684{
8685 return atomic_exchange_explicit(const_cast<volatile atomic_llong*>
8686 (__obj), __desr, __o);
8687}
8688
8689inline _LIBCPP_INLINE_VISIBILITY
8690bool
8691atomic_compare_exchange_weak(volatile atomic_llong* __obj, long long* __exp,
8692 long long __desr)
8693{
8694 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
8695 memory_order_seq_cst, memory_order_seq_cst);
8696}
8697
8698inline _LIBCPP_INLINE_VISIBILITY
8699bool
8700atomic_compare_exchange_weak(atomic_llong* __obj, long long* __exp,
8701 long long __desr)
8702{
8703 return atomic_compare_exchange_weak(const_cast<volatile atomic_llong*>
8704 (__obj), __exp, __desr);
8705}
8706
8707inline _LIBCPP_INLINE_VISIBILITY
8708bool
8709atomic_compare_exchange_strong(volatile atomic_llong* __obj,
8710 long long* __exp, long long __desr)
8711{
8712 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
8713 memory_order_seq_cst, memory_order_seq_cst);
8714}
8715
8716inline _LIBCPP_INLINE_VISIBILITY
8717bool
8718atomic_compare_exchange_strong(atomic_llong* __obj, long long* __exp,
8719 long long __desr)
8720{
8721 return atomic_compare_exchange_strong(const_cast<volatile atomic_llong*>
8722 (__obj), __exp, __desr);
8723}
8724
8725inline _LIBCPP_INLINE_VISIBILITY
8726bool
8727atomic_compare_exchange_weak_explicit(volatile atomic_llong* __obj,
8728 long long* __exp,
8729 long long __desr, memory_order __s,
8730 memory_order __f)
8731{
8732 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
8733 __f);
8734}
8735
8736inline _LIBCPP_INLINE_VISIBILITY
8737bool
8738atomic_compare_exchange_weak_explicit(atomic_llong* __obj, long long* __exp,
8739 long long __desr, memory_order __s,
8740 memory_order __f)
8741{
8742 return atomic_compare_exchange_weak_explicit(
8743 const_cast<volatile atomic_llong*>(__obj), __exp, __desr, __s, __f);
8744}
8745
8746inline _LIBCPP_INLINE_VISIBILITY
8747bool
8748atomic_compare_exchange_strong_explicit(volatile atomic_llong* __obj,
8749 long long* __exp,
8750 long long __desr, memory_order __s,
8751 memory_order __f)
8752{
8753 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
8754 __f);
8755}
8756
8757inline _LIBCPP_INLINE_VISIBILITY
8758bool
8759atomic_compare_exchange_strong_explicit(atomic_llong* __obj,
8760 long long* __exp,
8761 long long __desr, memory_order __s,
8762 memory_order __f)
8763{
8764 return atomic_compare_exchange_strong_explicit(
8765 const_cast<volatile atomic_llong*>(__obj), __exp, __desr, __s, __f);
8766}
8767
8768inline _LIBCPP_INLINE_VISIBILITY
8769long long
8770atomic_fetch_add(volatile atomic_llong* __obj, long long __v)
8771{
8772 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
8773}
8774
8775inline _LIBCPP_INLINE_VISIBILITY
8776long long
8777atomic_fetch_add(atomic_llong* __obj, long long __v)
8778{
8779 return atomic_fetch_add(const_cast<volatile atomic_llong*>(__obj), __v);
8780}
8781
8782inline _LIBCPP_INLINE_VISIBILITY
8783long long
8784atomic_fetch_add_explicit(volatile atomic_llong* __obj, long long __v,
8785 memory_order __o)
8786{
8787 return __atomic_fetch_add(&__obj->__v_, __v, __o);
8788}
8789
8790inline _LIBCPP_INLINE_VISIBILITY
8791long long
8792atomic_fetch_add_explicit(atomic_llong* __obj, long long __v,
8793 memory_order __o)
8794{
8795 return atomic_fetch_add_explicit(const_cast<volatile atomic_llong*>(__obj),
8796 __v, __o);
8797}
8798
8799inline _LIBCPP_INLINE_VISIBILITY
8800long long
8801atomic_fetch_sub(volatile atomic_llong* __obj, long long __v)
8802{
8803 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
8804}
8805
8806inline _LIBCPP_INLINE_VISIBILITY
8807long long
8808atomic_fetch_sub(atomic_llong* __obj, long long __v)
8809{
8810 return atomic_fetch_sub(const_cast<volatile atomic_llong*>(__obj), __v);
8811}
8812
8813inline _LIBCPP_INLINE_VISIBILITY
8814long long
8815atomic_fetch_sub_explicit(volatile atomic_llong* __obj, long long __v,
8816 memory_order __o)
8817{
8818 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
8819}
8820
8821inline _LIBCPP_INLINE_VISIBILITY
8822long long
8823atomic_fetch_sub_explicit(atomic_llong* __obj, long long __v,
8824 memory_order __o)
8825{
8826 return atomic_fetch_sub_explicit(const_cast<volatile atomic_llong*>(__obj),
8827 __v, __o);
8828}
8829
8830inline _LIBCPP_INLINE_VISIBILITY
8831long long
8832atomic_fetch_and(volatile atomic_llong* __obj, long long __v)
8833{
8834 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
8835}
8836
8837inline _LIBCPP_INLINE_VISIBILITY
8838long long
8839atomic_fetch_and(atomic_llong* __obj, long long __v)
8840{
8841 return atomic_fetch_and(const_cast<volatile atomic_llong*>(__obj), __v);
8842}
8843
8844inline _LIBCPP_INLINE_VISIBILITY
8845long long
8846atomic_fetch_and_explicit(volatile atomic_llong* __obj, long long __v,
8847 memory_order __o)
8848{
8849 return __atomic_fetch_and(&__obj->__v_, __v, __o);
8850}
8851
8852inline _LIBCPP_INLINE_VISIBILITY
8853long long
8854atomic_fetch_and_explicit(atomic_llong* __obj, long long __v,
8855 memory_order __o)
8856{
8857 return atomic_fetch_and_explicit(const_cast<volatile atomic_llong*>(__obj),
8858 __v, __o);
8859}
8860
8861inline _LIBCPP_INLINE_VISIBILITY
8862long long
8863atomic_fetch_or(volatile atomic_llong* __obj, long long __v)
8864{
8865 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
8866}
8867
8868inline _LIBCPP_INLINE_VISIBILITY
8869long long
8870atomic_fetch_or(atomic_llong* __obj, long long __v)
8871{
8872 return atomic_fetch_or(const_cast<volatile atomic_llong*>(__obj), __v);
8873}
8874
8875inline _LIBCPP_INLINE_VISIBILITY
8876long long
8877atomic_fetch_or_explicit(volatile atomic_llong* __obj, long long __v,
8878 memory_order __o)
8879{
8880 return __atomic_fetch_or(&__obj->__v_, __v, __o);
8881}
8882
8883inline _LIBCPP_INLINE_VISIBILITY
8884long long
8885atomic_fetch_or_explicit(atomic_llong* __obj, long long __v,
8886 memory_order __o)
8887{
8888 return atomic_fetch_or_explicit(const_cast<volatile atomic_llong*>(__obj),
8889 __v, __o);
8890}
8891
8892inline _LIBCPP_INLINE_VISIBILITY
8893long long
8894atomic_fetch_xor(volatile atomic_llong* __obj, long long __v)
8895{
8896 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
8897}
8898
8899inline _LIBCPP_INLINE_VISIBILITY
8900long long
8901atomic_fetch_xor(atomic_llong* __obj, long long __v)
8902{
8903 return atomic_fetch_xor(const_cast<volatile atomic_llong*>(__obj), __v);
8904}
8905
8906inline _LIBCPP_INLINE_VISIBILITY
8907long long
8908atomic_fetch_xor_explicit(volatile atomic_llong* __obj, long long __v,
8909 memory_order __o)
8910{
8911 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
8912}
8913
8914inline _LIBCPP_INLINE_VISIBILITY
8915long long
8916atomic_fetch_xor_explicit(atomic_llong* __obj, long long __v,
8917 memory_order __o)
8918{
8919 return atomic_fetch_xor_explicit(const_cast<volatile atomic_llong*>(__obj),
8920 __v, __o);
8921}
8922
8923// atomic_ullong
8924
8925struct atomic_ullong;
8926
8927bool atomic_is_lock_free(const volatile atomic_ullong*);
8928bool atomic_is_lock_free(const atomic_ullong*);
8929void atomic_init(volatile atomic_ullong*, unsigned long long);
8930void atomic_init(atomic_ullong*, unsigned long long);
8931void atomic_store(volatile atomic_ullong*, unsigned long long);
8932void atomic_store(atomic_ullong*, unsigned long long);
8933void atomic_store_explicit(volatile atomic_ullong*, unsigned long long,
8934 memory_order);
8935void atomic_store_explicit(atomic_ullong*, unsigned long long, memory_order);
8936unsigned long long atomic_load(const volatile atomic_ullong*);
8937unsigned long long atomic_load(const atomic_ullong*);
8938unsigned long long atomic_load_explicit(const volatile atomic_ullong*,
8939 memory_order);
8940unsigned long long atomic_load_explicit(const atomic_ullong*, memory_order);
8941unsigned long long atomic_exchange(volatile atomic_ullong*, unsigned long long);
8942unsigned long long atomic_exchange(atomic_ullong*, unsigned long long);
8943unsigned long long atomic_exchange_explicit(volatile atomic_ullong*,
8944 unsigned long long, memory_order);
8945unsigned long long atomic_exchange_explicit(atomic_ullong*, unsigned long long,
8946 memory_order);
8947bool atomic_compare_exchange_weak(volatile atomic_ullong*, unsigned long long*,
8948 unsigned long long);
8949bool atomic_compare_exchange_weak(atomic_ullong*, unsigned long long*,
8950 unsigned long long);
8951bool atomic_compare_exchange_strong(volatile atomic_ullong*,
8952 unsigned long long*, unsigned long long);
8953bool atomic_compare_exchange_strong(atomic_ullong*, unsigned long long*,
8954 unsigned long long);
8955bool atomic_compare_exchange_weak_explicit(volatile atomic_ullong*,
8956 unsigned long long*,
8957 unsigned long long,
8958 memory_order, memory_order);
8959bool atomic_compare_exchange_weak_explicit(atomic_ullong*, unsigned long long*,
8960 unsigned long long, memory_order,
8961 memory_order);
8962bool atomic_compare_exchange_strong_explicit(volatile atomic_ullong*,
8963 unsigned long long*,
8964 unsigned long long,
8965 memory_order, memory_order);
8966bool atomic_compare_exchange_strong_explicit(atomic_ullong*,
8967 unsigned long long*,
8968 unsigned long long, memory_order,
8969 memory_order);
8970unsigned long long atomic_fetch_add(volatile atomic_ullong*,
8971 unsigned long long);
8972unsigned long long atomic_fetch_add(atomic_ullong*, unsigned long long);
8973unsigned long long atomic_fetch_add_explicit(volatile atomic_ullong*,
8974 unsigned long long, memory_order);
8975unsigned long long atomic_fetch_add_explicit(atomic_ullong*, unsigned long long,
8976 memory_order);
8977unsigned long long atomic_fetch_sub(volatile atomic_ullong*,
8978 unsigned long long);
8979unsigned long long atomic_fetch_sub(atomic_ullong*, unsigned long long);
8980unsigned long long atomic_fetch_sub_explicit(volatile atomic_ullong*,
8981 unsigned long long, memory_order);
8982unsigned long long atomic_fetch_sub_explicit(atomic_ullong*, unsigned long long,
8983 memory_order);
8984unsigned long long atomic_fetch_and(volatile atomic_ullong*, unsigned long long);
8985unsigned long long atomic_fetch_and(atomic_ullong*, unsigned long long);
8986unsigned long long atomic_fetch_and_explicit(volatile atomic_ullong*,
8987 unsigned long long, memory_order);
8988unsigned long long atomic_fetch_and_explicit(atomic_ullong*, unsigned long long,
8989 memory_order);
8990unsigned long long atomic_fetch_or(volatile atomic_ullong*, unsigned long long);
8991unsigned long long atomic_fetch_or(atomic_ullong*, unsigned long long);
8992unsigned long long atomic_fetch_or_explicit(volatile atomic_ullong*,
8993 unsigned long long, memory_order);
8994unsigned long long atomic_fetch_or_explicit(atomic_ullong*, unsigned long long,
8995 memory_order);
8996unsigned long long atomic_fetch_xor(volatile atomic_ullong*,
8997 unsigned long long);
8998unsigned long long atomic_fetch_xor(atomic_ullong*, unsigned long long);
8999unsigned long long atomic_fetch_xor_explicit(volatile atomic_ullong*,
9000 unsigned long long, memory_order);
9001unsigned long long atomic_fetch_xor_explicit(atomic_ullong*, unsigned long long,
9002 memory_order);
9003
9004typedef struct atomic_ullong
9005{
9006 unsigned long long __v_;
9007
9008 _LIBCPP_INLINE_VISIBILITY
9009 bool is_lock_free() const volatile
9010 {return atomic_is_lock_free(this);}
9011 _LIBCPP_INLINE_VISIBILITY
9012 bool is_lock_free() const
9013 {return atomic_is_lock_free(this);}
9014 _LIBCPP_INLINE_VISIBILITY
9015 void store(unsigned long long __v,
9016 memory_order __o = memory_order_seq_cst) volatile
9017 {atomic_store_explicit(this, __v, __o);}
9018 _LIBCPP_INLINE_VISIBILITY
9019 void store(unsigned long long __v, memory_order __o = memory_order_seq_cst)
9020 {atomic_store_explicit(this, __v, __o);}
9021 _LIBCPP_INLINE_VISIBILITY
9022 unsigned long long load(memory_order __o = memory_order_seq_cst) const
9023 volatile
9024 {return atomic_load_explicit(this, __o);}
9025 _LIBCPP_INLINE_VISIBILITY
9026 unsigned long long load(memory_order __o = memory_order_seq_cst) const
9027 {return atomic_load_explicit(this, __o);}
9028 _LIBCPP_INLINE_VISIBILITY
9029 operator unsigned long long() const volatile
9030 {return load();}
9031 _LIBCPP_INLINE_VISIBILITY
9032 operator unsigned long long() const
9033 {return load();}
9034 _LIBCPP_INLINE_VISIBILITY
9035 unsigned long long exchange(unsigned long long __v,
9036 memory_order __o = memory_order_seq_cst) volatile
9037 {return atomic_exchange_explicit(this, __v, __o);}
9038 _LIBCPP_INLINE_VISIBILITY
9039 unsigned long long exchange(unsigned long long __v,
9040 memory_order __o = memory_order_seq_cst)
9041 {return atomic_exchange_explicit(this, __v, __o);}
9042 _LIBCPP_INLINE_VISIBILITY
9043 bool compare_exchange_weak(unsigned long long& __v, unsigned long long __e,
9044 memory_order __s, memory_order __f) volatile
9045 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
9046 __f);}
9047 _LIBCPP_INLINE_VISIBILITY
9048 bool compare_exchange_weak(unsigned long long& __v, unsigned long long __e,
9049 memory_order __s, memory_order __f)
9050 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
9051 __f);}
9052 _LIBCPP_INLINE_VISIBILITY
9053 bool compare_exchange_strong(unsigned long long& __v, unsigned long long __e,
9054 memory_order __s, memory_order __f) volatile
9055 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
9056 __f);}
9057 _LIBCPP_INLINE_VISIBILITY
9058 bool compare_exchange_strong(unsigned long long& __v, unsigned long long __e,
9059 memory_order __s, memory_order __f)
9060 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
9061 __f);}
9062 _LIBCPP_INLINE_VISIBILITY
9063 bool compare_exchange_weak(unsigned long long& __v, unsigned long long __e,
9064 memory_order __s = memory_order_seq_cst) volatile
9065 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
9066 __translate_memory_order(__s));}
9067 _LIBCPP_INLINE_VISIBILITY
9068 bool compare_exchange_weak(unsigned long long& __v, unsigned long long __e,
9069 memory_order __s = memory_order_seq_cst)
9070 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
9071 __translate_memory_order(__s));}
9072 _LIBCPP_INLINE_VISIBILITY
9073 bool compare_exchange_strong(unsigned long long& __v, unsigned long long __e,
9074 memory_order __s = memory_order_seq_cst) volatile
9075 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
9076 __translate_memory_order(__s));}
9077 _LIBCPP_INLINE_VISIBILITY
9078 bool compare_exchange_strong(unsigned long long& __v, unsigned long long __e,
9079 memory_order __s = memory_order_seq_cst)
9080 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
9081 __translate_memory_order(__s));}
9082 _LIBCPP_INLINE_VISIBILITY
9083 unsigned long long fetch_add(unsigned long long __v,
9084 memory_order __o = memory_order_seq_cst) volatile
9085 {return atomic_fetch_add_explicit(this, __v, __o);}
9086 _LIBCPP_INLINE_VISIBILITY
9087 unsigned long long fetch_add(unsigned long long __v,
9088 memory_order __o = memory_order_seq_cst)
9089 {return atomic_fetch_add_explicit(this, __v, __o);}
9090 _LIBCPP_INLINE_VISIBILITY
9091 unsigned long long fetch_sub(unsigned long long __v,
9092 memory_order __o = memory_order_seq_cst) volatile
9093 {return atomic_fetch_sub_explicit(this, __v, __o);}
9094 _LIBCPP_INLINE_VISIBILITY
9095 unsigned long long fetch_sub(unsigned long long __v,
9096 memory_order __o = memory_order_seq_cst)
9097 {return atomic_fetch_sub_explicit(this, __v, __o);}
9098 _LIBCPP_INLINE_VISIBILITY
9099 unsigned long long fetch_and(unsigned long long __v,
9100 memory_order __o = memory_order_seq_cst) volatile
9101 {return atomic_fetch_and_explicit(this, __v, __o);}
9102 _LIBCPP_INLINE_VISIBILITY
9103 unsigned long long fetch_and(unsigned long long __v,
9104 memory_order __o = memory_order_seq_cst)
9105 {return atomic_fetch_and_explicit(this, __v, __o);}
9106 _LIBCPP_INLINE_VISIBILITY
9107 unsigned long long fetch_or(unsigned long long __v,
9108 memory_order __o = memory_order_seq_cst) volatile
9109 {return atomic_fetch_or_explicit(this, __v, __o);}
9110 _LIBCPP_INLINE_VISIBILITY
9111 unsigned long long fetch_or(unsigned long long __v,
9112 memory_order __o = memory_order_seq_cst)
9113 {return atomic_fetch_or_explicit(this, __v, __o);}
9114 _LIBCPP_INLINE_VISIBILITY
9115 unsigned long long fetch_xor(unsigned long long __v,
9116 memory_order __o = memory_order_seq_cst) volatile
9117 {return atomic_fetch_xor_explicit(this, __v, __o);}
9118 _LIBCPP_INLINE_VISIBILITY
9119 unsigned long long fetch_xor(unsigned long long __v,
9120 memory_order __o = memory_order_seq_cst)
9121 {return atomic_fetch_xor_explicit(this, __v, __o);}
9122#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
9123 atomic_ullong() = default;
9124#else
9125 _LIBCPP_INLINE_VISIBILITY
9126 atomic_ullong() {}
9127#endif
9128 _LIBCPP_INLINE_VISIBILITY
9129 /*constexpr*/ atomic_ullong(unsigned long long __v)
9130 : __v_(__v) {}
9131#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
9132 atomic_ullong(const atomic_ullong&) = delete;
9133 atomic_ullong& operator=(const atomic_ullong&) = delete;
9134 atomic_ullong& operator=(const atomic_ullong&) volatile = delete;
9135#else
9136private:
9137 atomic_ullong(const atomic_ullong&);
9138 atomic_ullong& operator=(const atomic_ullong&);
9139 atomic_ullong& operator=(const atomic_ullong&) volatile;
9140public:
9141#endif
9142 _LIBCPP_INLINE_VISIBILITY
9143 unsigned long long operator=(unsigned long long __v) volatile
9144 {store(__v); return __v;}
9145 _LIBCPP_INLINE_VISIBILITY
9146 unsigned long long operator=(unsigned long long __v)
9147 {store(__v); return __v;}
9148 _LIBCPP_INLINE_VISIBILITY
9149 unsigned long long operator++(int) volatile
9150 {typedef unsigned long long type; return fetch_add(type(1));}
9151 _LIBCPP_INLINE_VISIBILITY
9152 long operator++(int)
9153 {typedef unsigned long long type; return fetch_add(type(1));}
9154 _LIBCPP_INLINE_VISIBILITY
9155 long operator--(int) volatile
9156 {typedef unsigned long long type; return fetch_sub(type(1));}
9157 _LIBCPP_INLINE_VISIBILITY
9158 long operator--(int)
9159 {typedef unsigned long long type; return fetch_sub(type(1));}
9160 _LIBCPP_INLINE_VISIBILITY
9161 long operator++() volatile
9162 {typedef unsigned long long type; return type(fetch_add(type(1)) + 1);}
9163 _LIBCPP_INLINE_VISIBILITY
9164 long operator++()
9165 {typedef unsigned long long type; return type(fetch_add(type(1)) + 1);}
9166 _LIBCPP_INLINE_VISIBILITY
9167 long operator--() volatile
9168 {typedef unsigned long long type; return type(fetch_sub(type(1)) - 1);}
9169 _LIBCPP_INLINE_VISIBILITY
9170 long operator--()
9171 {typedef unsigned long long type; return type(fetch_sub(type(1)) - 1);}
9172 _LIBCPP_INLINE_VISIBILITY
9173 long operator+=(long __v) volatile
9174 {typedef unsigned long long type; return type(fetch_add(__v) + __v);}
9175 _LIBCPP_INLINE_VISIBILITY
9176 long operator+=(long __v)
9177 {typedef unsigned long long type; return type(fetch_add(__v) + __v);}
9178 _LIBCPP_INLINE_VISIBILITY
9179 long operator-=(long __v) volatile
9180 {typedef unsigned long long type; return type(fetch_sub(__v) - __v);}
9181 _LIBCPP_INLINE_VISIBILITY
9182 long operator-=(long __v)
9183 {typedef unsigned long long type; return type(fetch_sub(__v) - __v);}
9184 _LIBCPP_INLINE_VISIBILITY
9185 long operator&=(long __v) volatile
9186 {typedef unsigned long long type; return type(fetch_and(__v) & __v);}
9187 _LIBCPP_INLINE_VISIBILITY
9188 long operator&=(long __v)
9189 {typedef unsigned long long type; return type(fetch_and(__v) & __v);}
9190 _LIBCPP_INLINE_VISIBILITY
9191 long operator|=(long __v) volatile
9192 {typedef unsigned long long type; return type(fetch_or(__v) | __v);}
9193 _LIBCPP_INLINE_VISIBILITY
9194 long operator|=(long __v)
9195 {typedef unsigned long long type; return type(fetch_or(__v) | __v);}
9196 _LIBCPP_INLINE_VISIBILITY
9197 long operator^=(long __v) volatile
9198 {typedef unsigned long long type; return type(fetch_xor(__v) ^ __v);}
9199 _LIBCPP_INLINE_VISIBILITY
9200 long operator^=(long __v)
9201 {typedef unsigned long long type; return type(fetch_xor(__v) ^ __v);}
9202} atomic_ullong;
9203
9204inline _LIBCPP_INLINE_VISIBILITY
9205bool
9206atomic_is_lock_free(const volatile atomic_ullong*)
9207{
9208 typedef unsigned long long type;
9209 return __atomic_is_lock_free(type);
9210}
9211
9212inline _LIBCPP_INLINE_VISIBILITY
9213bool
9214atomic_is_lock_free(const atomic_ullong* __obj)
9215{
9216 return atomic_is_lock_free(const_cast<volatile atomic_ullong*>(__obj));
9217}
9218
9219inline _LIBCPP_INLINE_VISIBILITY
9220void
9221atomic_init(volatile atomic_ullong* __obj, unsigned long long __desr)
9222{
9223 __obj->__v_ = __desr;
9224}
9225
9226inline _LIBCPP_INLINE_VISIBILITY
9227void
9228atomic_init(atomic_ullong* __obj, unsigned long long __desr)
9229{
9230 __obj->__v_ = __desr;
9231}
9232
9233inline _LIBCPP_INLINE_VISIBILITY
9234void
9235atomic_store(volatile atomic_ullong* __obj, unsigned long long __desr)
9236{
9237 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
9238}
9239
9240inline _LIBCPP_INLINE_VISIBILITY
9241void
9242atomic_store(atomic_ullong* __obj, unsigned long long __desr)
9243{
9244 atomic_store(const_cast<volatile atomic_ullong*>(__obj), __desr);
9245}
9246
9247inline _LIBCPP_INLINE_VISIBILITY
9248void
9249atomic_store_explicit(volatile atomic_ullong* __obj, unsigned long long __desr,
9250 memory_order __o)
9251{
9252 __atomic_store(&__obj->__v_, __desr, __o);
9253}
9254
9255inline _LIBCPP_INLINE_VISIBILITY
9256void
9257atomic_store_explicit(atomic_ullong* __obj, unsigned long long __desr,
9258 memory_order __o)
9259{
9260 atomic_store_explicit(const_cast<volatile atomic_ullong*>(__obj), __desr,
9261 __o);
9262}
9263
9264inline _LIBCPP_INLINE_VISIBILITY
9265unsigned long long
9266atomic_load(const volatile atomic_ullong* __obj)
9267{
9268 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
9269}
9270
9271inline _LIBCPP_INLINE_VISIBILITY
9272unsigned long long
9273atomic_load(const atomic_ullong* __obj)
9274{
9275 return atomic_load(const_cast<const volatile atomic_ullong*>(__obj));
9276}
9277
9278inline _LIBCPP_INLINE_VISIBILITY
9279unsigned long long
9280atomic_load_explicit(const volatile atomic_ullong* __obj, memory_order __o)
9281{
9282 return __atomic_load(&__obj->__v_, __o);
9283}
9284
9285inline _LIBCPP_INLINE_VISIBILITY
9286unsigned long long
9287atomic_load_explicit(const atomic_ullong* __obj, memory_order __o)
9288{
9289 return atomic_load_explicit(const_cast<const volatile atomic_ullong*>
9290 (__obj), __o);
9291}
9292
9293inline _LIBCPP_INLINE_VISIBILITY
9294unsigned long long
9295atomic_exchange(volatile atomic_ullong* __obj, unsigned long long __desr)
9296{
9297 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
9298}
9299
9300inline _LIBCPP_INLINE_VISIBILITY
9301unsigned long long
9302atomic_exchange(atomic_ullong* __obj, unsigned long long __desr)
9303{
9304 return atomic_exchange(const_cast<volatile atomic_ullong*>(__obj), __desr);
9305}
9306
9307inline _LIBCPP_INLINE_VISIBILITY
9308unsigned long long
9309atomic_exchange_explicit(volatile atomic_ullong* __obj,
9310 unsigned long long __desr, memory_order __o)
9311{
9312 return __atomic_exchange(&__obj->__v_, __desr, __o);
9313}
9314
9315inline _LIBCPP_INLINE_VISIBILITY
9316unsigned long long
9317atomic_exchange_explicit(atomic_ullong* __obj, unsigned long long __desr,
9318 memory_order __o)
9319{
9320 return atomic_exchange_explicit(const_cast<volatile atomic_ullong*>
9321 (__obj), __desr, __o);
9322}
9323
9324inline _LIBCPP_INLINE_VISIBILITY
9325bool
9326atomic_compare_exchange_weak(volatile atomic_ullong* __obj,
9327 unsigned long long* __exp,
9328 unsigned long long __desr)
9329{
9330 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
9331 memory_order_seq_cst, memory_order_seq_cst);
9332}
9333
9334inline _LIBCPP_INLINE_VISIBILITY
9335bool
9336atomic_compare_exchange_weak(atomic_ullong* __obj, unsigned long long* __exp,
9337 unsigned long long __desr)
9338{
9339 return atomic_compare_exchange_weak(const_cast<volatile atomic_ullong*>
9340 (__obj), __exp, __desr);
9341}
9342
9343inline _LIBCPP_INLINE_VISIBILITY
9344bool
9345atomic_compare_exchange_strong(volatile atomic_ullong* __obj,
9346 unsigned long long* __exp,
9347 unsigned long long __desr)
9348{
9349 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
9350 memory_order_seq_cst, memory_order_seq_cst);
9351}
9352
9353inline _LIBCPP_INLINE_VISIBILITY
9354bool
9355atomic_compare_exchange_strong(atomic_ullong* __obj, unsigned long long* __exp,
9356 unsigned long long __desr)
9357{
9358 return atomic_compare_exchange_strong(const_cast<volatile atomic_ullong*>
9359 (__obj), __exp, __desr);
9360}
9361
9362inline _LIBCPP_INLINE_VISIBILITY
9363bool
9364atomic_compare_exchange_weak_explicit(volatile atomic_ullong* __obj,
9365 unsigned long long* __exp,
9366 unsigned long long __desr,
9367 memory_order __s, memory_order __f)
9368{
9369 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
9370 __f);
9371}
9372
9373inline _LIBCPP_INLINE_VISIBILITY
9374bool
9375atomic_compare_exchange_weak_explicit(atomic_ullong* __obj,
9376 unsigned long long* __exp,
9377 unsigned long long __desr,
9378 memory_order __s, memory_order __f)
9379{
9380 return atomic_compare_exchange_weak_explicit(
9381 const_cast<volatile atomic_ullong*>(__obj), __exp, __desr, __s, __f);
9382}
9383
9384inline _LIBCPP_INLINE_VISIBILITY
9385bool
9386atomic_compare_exchange_strong_explicit(volatile atomic_ullong* __obj,
9387 unsigned long long* __exp,
9388 unsigned long long __desr,
9389 memory_order __s, memory_order __f)
9390{
9391 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
9392 __f);
9393}
9394
9395inline _LIBCPP_INLINE_VISIBILITY
9396bool
9397atomic_compare_exchange_strong_explicit(atomic_ullong* __obj,
9398 unsigned long long* __exp,
9399 unsigned long long __desr,
9400 memory_order __s, memory_order __f)
9401{
9402 return atomic_compare_exchange_strong_explicit(
9403 const_cast<volatile atomic_ullong*>(__obj), __exp, __desr, __s, __f);
9404}
9405
9406inline _LIBCPP_INLINE_VISIBILITY
9407unsigned long long
9408atomic_fetch_add(volatile atomic_ullong* __obj, unsigned long long __v)
9409{
9410 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
9411}
9412
9413inline _LIBCPP_INLINE_VISIBILITY
9414unsigned long long
9415atomic_fetch_add(atomic_ullong* __obj, unsigned long long __v)
9416{
9417 return atomic_fetch_add(const_cast<volatile atomic_ullong*>(__obj), __v);
9418}
9419
9420inline _LIBCPP_INLINE_VISIBILITY
9421unsigned long long
9422atomic_fetch_add_explicit(volatile atomic_ullong* __obj, unsigned long long __v,
9423 memory_order __o)
9424{
9425 return __atomic_fetch_add(&__obj->__v_, __v, __o);
9426}
9427
9428inline _LIBCPP_INLINE_VISIBILITY
9429unsigned long long
9430atomic_fetch_add_explicit(atomic_ullong* __obj, unsigned long long __v,
9431 memory_order __o)
9432{
9433 return atomic_fetch_add_explicit(const_cast<volatile atomic_ullong*>(__obj),
9434 __v, __o);
9435}
9436
9437inline _LIBCPP_INLINE_VISIBILITY
9438unsigned long long
9439atomic_fetch_sub(volatile atomic_ullong* __obj, unsigned long long __v)
9440{
9441 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
9442}
9443
9444inline _LIBCPP_INLINE_VISIBILITY
9445unsigned long long
9446atomic_fetch_sub(atomic_ullong* __obj, unsigned long long __v)
9447{
9448 return atomic_fetch_sub(const_cast<volatile atomic_ullong*>(__obj), __v);
9449}
9450
9451inline _LIBCPP_INLINE_VISIBILITY
9452unsigned long long
9453atomic_fetch_sub_explicit(volatile atomic_ullong* __obj, unsigned long long __v,
9454 memory_order __o)
9455{
9456 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
9457}
9458
9459inline _LIBCPP_INLINE_VISIBILITY
9460unsigned long long
9461atomic_fetch_sub_explicit(atomic_ullong* __obj, unsigned long long __v,
9462 memory_order __o)
9463{
9464 return atomic_fetch_sub_explicit(const_cast<volatile atomic_ullong*>(__obj),
9465 __v, __o);
9466}
9467
9468inline _LIBCPP_INLINE_VISIBILITY
9469unsigned long long
9470atomic_fetch_and(volatile atomic_ullong* __obj, unsigned long long __v)
9471{
9472 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
9473}
9474
9475inline _LIBCPP_INLINE_VISIBILITY
9476unsigned long long
9477atomic_fetch_and(atomic_ullong* __obj, unsigned long long __v)
9478{
9479 return atomic_fetch_and(const_cast<volatile atomic_ullong*>(__obj), __v);
9480}
9481
9482inline _LIBCPP_INLINE_VISIBILITY
9483unsigned long long
9484atomic_fetch_and_explicit(volatile atomic_ullong* __obj, unsigned long long __v,
9485 memory_order __o)
9486{
9487 return __atomic_fetch_and(&__obj->__v_, __v, __o);
9488}
9489
9490inline _LIBCPP_INLINE_VISIBILITY
9491unsigned long long
9492atomic_fetch_and_explicit(atomic_ullong* __obj, unsigned long long __v,
9493 memory_order __o)
9494{
9495 return atomic_fetch_and_explicit(const_cast<volatile atomic_ullong*>(__obj),
9496 __v, __o);
9497}
9498
9499inline _LIBCPP_INLINE_VISIBILITY
9500unsigned long long
9501atomic_fetch_or(volatile atomic_ullong* __obj, unsigned long long __v)
9502{
9503 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
9504}
9505
9506inline _LIBCPP_INLINE_VISIBILITY
9507unsigned long long
9508atomic_fetch_or(atomic_ullong* __obj, unsigned long long __v)
9509{
9510 return atomic_fetch_or(const_cast<volatile atomic_ullong*>(__obj), __v);
9511}
9512
9513inline _LIBCPP_INLINE_VISIBILITY
9514unsigned long long
9515atomic_fetch_or_explicit(volatile atomic_ullong* __obj, unsigned long long __v,
9516 memory_order __o)
9517{
9518 return __atomic_fetch_or(&__obj->__v_, __v, __o);
9519}
9520
9521inline _LIBCPP_INLINE_VISIBILITY
9522unsigned long long
9523atomic_fetch_or_explicit(atomic_ullong* __obj, unsigned long long __v,
9524 memory_order __o)
9525{
9526 return atomic_fetch_or_explicit(const_cast<volatile atomic_ullong*>(__obj),
9527 __v, __o);
9528}
9529
9530inline _LIBCPP_INLINE_VISIBILITY
9531unsigned long long
9532atomic_fetch_xor(volatile atomic_ullong* __obj, unsigned long long __v)
9533{
9534 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
9535}
9536
9537inline _LIBCPP_INLINE_VISIBILITY
9538unsigned long long
9539atomic_fetch_xor(atomic_ullong* __obj, unsigned long long __v)
9540{
9541 return atomic_fetch_xor(const_cast<volatile atomic_ullong*>(__obj), __v);
9542}
9543
9544inline _LIBCPP_INLINE_VISIBILITY
9545unsigned long long
9546atomic_fetch_xor_explicit(volatile atomic_ullong* __obj, unsigned long long __v,
9547 memory_order __o)
9548{
9549 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
9550}
9551
9552inline _LIBCPP_INLINE_VISIBILITY
9553unsigned long long
9554atomic_fetch_xor_explicit(atomic_ullong* __obj, unsigned long long __v,
9555 memory_order __o)
9556{
9557 return atomic_fetch_xor_explicit(const_cast<volatile atomic_ullong*>(__obj),
9558 __v, __o);
9559}
9560
9561#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
9562
9563// atomic_char16_t
9564
9565struct atomic_char16_t;
9566
9567bool atomic_is_lock_free(const volatile atomic_char16_t*);
9568bool atomic_is_lock_free(const atomic_char16_t*);
9569void atomic_init(volatile atomic_char16_t*, char16_t);
9570void atomic_init(atomic_char16_t*, char16_t);
9571void atomic_store(volatile atomic_char16_t*, char16_t);
9572void atomic_store(atomic_char16_t*, char16_t);
9573void atomic_store_explicit(volatile atomic_char16_t*, char16_t, memory_order);
9574void atomic_store_explicit(atomic_char16_t*, char16_t, memory_order);
9575char16_t atomic_load(const volatile atomic_char16_t*);
9576char16_t atomic_load(const atomic_char16_t*);
9577char16_t atomic_load_explicit(const volatile atomic_char16_t*, memory_order);
9578char16_t atomic_load_explicit(const atomic_char16_t*, memory_order);
9579char16_t atomic_exchange(volatile atomic_char16_t*, char16_t);
9580char16_t atomic_exchange(atomic_char16_t*, char16_t);
9581char16_t atomic_exchange_explicit(volatile atomic_char16_t*, char16_t,
9582 memory_order);
9583char16_t atomic_exchange_explicit(atomic_char16_t*, char16_t, memory_order);
9584bool atomic_compare_exchange_weak(volatile atomic_char16_t*, char16_t*,
9585 char16_t);
9586bool atomic_compare_exchange_weak(atomic_char16_t*, char16_t*, char16_t);
9587bool atomic_compare_exchange_strong(volatile atomic_char16_t*, char16_t*,
9588 char16_t);
9589bool atomic_compare_exchange_strong(atomic_char16_t*, char16_t*, char16_t);
9590bool atomic_compare_exchange_weak_explicit(volatile atomic_char16_t*, char16_t*,
9591 char16_t, memory_order,
9592 memory_order);
9593bool atomic_compare_exchange_weak_explicit(atomic_char16_t*, char16_t*,
9594 char16_t, memory_order,
9595 memory_order);
9596bool atomic_compare_exchange_strong_explicit(volatile atomic_char16_t*,
9597 char16_t*, char16_t, memory_order,
9598 memory_order);
9599bool atomic_compare_exchange_strong_explicit(atomic_char16_t*, char16_t*,
9600 char16_t, memory_order,
9601 memory_order);
9602char16_t atomic_fetch_add(volatile atomic_char16_t*, char16_t);
9603char16_t atomic_fetch_add(atomic_char16_t*, char16_t);
9604char16_t atomic_fetch_add_explicit(volatile atomic_char16_t*, char16_t,
9605 memory_order);
9606char16_t atomic_fetch_add_explicit(atomic_char16_t*, char16_t, memory_order);
9607char16_t atomic_fetch_sub(volatile atomic_char16_t*, char16_t);
9608char16_t atomic_fetch_sub(atomic_char16_t*, char16_t);
9609char16_t atomic_fetch_sub_explicit(volatile atomic_char16_t*, char16_t,
9610 memory_order);
9611char16_t atomic_fetch_sub_explicit(atomic_char16_t*, char16_t, memory_order);
9612char16_t atomic_fetch_and(volatile atomic_char16_t*, char16_t);
9613char16_t atomic_fetch_and(atomic_char16_t*, char16_t);
9614char16_t atomic_fetch_and_explicit(volatile atomic_char16_t*, char16_t,
9615 memory_order);
9616char16_t atomic_fetch_and_explicit(atomic_char16_t*, char16_t, memory_order);
9617char16_t atomic_fetch_or(volatile atomic_char16_t*, char16_t);
9618char16_t atomic_fetch_or(atomic_char16_t*, char16_t);
9619char16_t atomic_fetch_or_explicit(volatile atomic_char16_t*, char16_t,
9620 memory_order);
9621char16_t atomic_fetch_or_explicit(atomic_char16_t*, char16_t, memory_order);
9622char16_t atomic_fetch_xor(volatile atomic_char16_t*, char16_t);
9623char16_t atomic_fetch_xor(atomic_char16_t*, char16_t);
9624char16_t atomic_fetch_xor_explicit(volatile atomic_char16_t*, char16_t,
9625 memory_order);
9626char16_t atomic_fetch_xor_explicit(atomic_char16_t*, char16_t, memory_order);
9627
9628typedef struct atomic_char16_t
9629{
9630 char16_t __v_;
9631
9632 _LIBCPP_INLINE_VISIBILITY
9633 bool is_lock_free() const volatile
9634 {return atomic_is_lock_free(this);}
9635 _LIBCPP_INLINE_VISIBILITY
9636 bool is_lock_free() const
9637 {return atomic_is_lock_free(this);}
9638 _LIBCPP_INLINE_VISIBILITY
9639 void store(char16_t __v, memory_order __o = memory_order_seq_cst) volatile
9640 {atomic_store_explicit(this, __v, __o);}
9641 _LIBCPP_INLINE_VISIBILITY
9642 void store(char16_t __v, memory_order __o = memory_order_seq_cst)
9643 {atomic_store_explicit(this, __v, __o);}
9644 _LIBCPP_INLINE_VISIBILITY
9645 char16_t load(memory_order __o = memory_order_seq_cst) const volatile
9646 {return atomic_load_explicit(this, __o);}
9647 _LIBCPP_INLINE_VISIBILITY
9648 char16_t load(memory_order __o = memory_order_seq_cst) const
9649 {return atomic_load_explicit(this, __o);}
9650 _LIBCPP_INLINE_VISIBILITY
9651 operator char16_t() const volatile
9652 {return load();}
9653 _LIBCPP_INLINE_VISIBILITY
9654 operator char16_t() const
9655 {return load();}
9656 _LIBCPP_INLINE_VISIBILITY
9657 char16_t exchange(char16_t __v,
9658 memory_order __o = memory_order_seq_cst) volatile
9659 {return atomic_exchange_explicit(this, __v, __o);}
9660 _LIBCPP_INLINE_VISIBILITY
9661 char16_t exchange(char16_t __v, memory_order __o = memory_order_seq_cst)
9662 {return atomic_exchange_explicit(this, __v, __o);}
9663 _LIBCPP_INLINE_VISIBILITY
9664 bool compare_exchange_weak(char16_t& __v, char16_t __e, memory_order __s,
9665 memory_order __f) volatile
9666 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
9667 __f);}
9668 _LIBCPP_INLINE_VISIBILITY
9669 bool compare_exchange_weak(char16_t& __v, char16_t __e, memory_order __s,
9670 memory_order __f)
9671 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
9672 __f);}
9673 _LIBCPP_INLINE_VISIBILITY
9674 bool compare_exchange_strong(char16_t& __v, char16_t __e, memory_order __s,
9675 memory_order __f) volatile
9676 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
9677 __f);}
9678 _LIBCPP_INLINE_VISIBILITY
9679 bool compare_exchange_strong(char16_t& __v, char16_t __e, memory_order __s,
9680 memory_order __f)
9681 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
9682 __f);}
9683 _LIBCPP_INLINE_VISIBILITY
9684 bool compare_exchange_weak(char16_t& __v, char16_t __e,
9685 memory_order __s = memory_order_seq_cst) volatile
9686 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
9687 __translate_memory_order(__s));}
9688 _LIBCPP_INLINE_VISIBILITY
9689 bool compare_exchange_weak(char16_t& __v, char16_t __e,
9690 memory_order __s = memory_order_seq_cst)
9691 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
9692 __translate_memory_order(__s));}
9693 _LIBCPP_INLINE_VISIBILITY
9694 bool compare_exchange_strong(char16_t& __v, char16_t __e,
9695 memory_order __s = memory_order_seq_cst) volatile
9696 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
9697 __translate_memory_order(__s));}
9698 _LIBCPP_INLINE_VISIBILITY
9699 bool compare_exchange_strong(char16_t& __v, char16_t __e,
9700 memory_order __s = memory_order_seq_cst)
9701 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
9702 __translate_memory_order(__s));}
9703 _LIBCPP_INLINE_VISIBILITY
9704 char16_t fetch_add(char16_t __v,
9705 memory_order __o = memory_order_seq_cst) volatile
9706 {return atomic_fetch_add_explicit(this, __v, __o);}
9707 _LIBCPP_INLINE_VISIBILITY
9708 char16_t fetch_add(char16_t __v, memory_order __o = memory_order_seq_cst)
9709 {return atomic_fetch_add_explicit(this, __v, __o);}
9710 _LIBCPP_INLINE_VISIBILITY
9711 char16_t fetch_sub(char16_t __v,
9712 memory_order __o = memory_order_seq_cst) volatile
9713 {return atomic_fetch_sub_explicit(this, __v, __o);}
9714 _LIBCPP_INLINE_VISIBILITY
9715 char16_t fetch_sub(char16_t __v, memory_order __o = memory_order_seq_cst)
9716 {return atomic_fetch_sub_explicit(this, __v, __o);}
9717 _LIBCPP_INLINE_VISIBILITY
9718 char16_t fetch_and(char16_t __v,
9719 memory_order __o = memory_order_seq_cst) volatile
9720 {return atomic_fetch_and_explicit(this, __v, __o);}
9721 _LIBCPP_INLINE_VISIBILITY
9722 char16_t fetch_and(char16_t __v, memory_order __o = memory_order_seq_cst)
9723 {return atomic_fetch_and_explicit(this, __v, __o);}
9724 _LIBCPP_INLINE_VISIBILITY
9725 char16_t fetch_or(char16_t __v,
9726 memory_order __o = memory_order_seq_cst) volatile
9727 {return atomic_fetch_or_explicit(this, __v, __o);}
9728 _LIBCPP_INLINE_VISIBILITY
9729 char16_t fetch_or(char16_t __v, memory_order __o = memory_order_seq_cst)
9730 {return atomic_fetch_or_explicit(this, __v, __o);}
9731 _LIBCPP_INLINE_VISIBILITY
9732 char16_t fetch_xor(char16_t __v,
9733 memory_order __o = memory_order_seq_cst) volatile
9734 {return atomic_fetch_xor_explicit(this, __v, __o);}
9735 _LIBCPP_INLINE_VISIBILITY
9736 char16_t fetch_xor(char16_t __v, memory_order __o = memory_order_seq_cst)
9737 {return atomic_fetch_xor_explicit(this, __v, __o);}
9738#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
9739 atomic_char16_t() = default;
9740#else
9741 _LIBCPP_INLINE_VISIBILITY
9742 atomic_char16_t() {}
9743#endif
9744 _LIBCPP_INLINE_VISIBILITY
9745 /*constexpr*/ atomic_char16_t(char16_t __v)
9746 : __v_(__v) {}
9747#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
9748 atomic_char16_t(const atomic_char16_t&) = delete;
9749 atomic_char16_t& operator=(const atomic_char16_t&) = delete;
9750 atomic_char16_t& operator=(const atomic_char16_t&) volatile = delete;
9751#else
9752private:
9753 atomic_char16_t(const atomic_char16_t&);
9754 atomic_char16_t& operator=(const atomic_char16_t&);
9755 atomic_char16_t& operator=(const atomic_char16_t&) volatile;
9756public:
9757#endif
9758 _LIBCPP_INLINE_VISIBILITY
9759 char16_t operator=(char16_t __v) volatile
9760 {store(__v); return __v;}
9761 _LIBCPP_INLINE_VISIBILITY
9762 char16_t operator=(char16_t __v)
9763 {store(__v); return __v;}
9764 _LIBCPP_INLINE_VISIBILITY
9765 char16_t operator++(int) volatile
9766 {return fetch_add(char16_t(1));}
9767 _LIBCPP_INLINE_VISIBILITY
9768 char16_t operator++(int)
9769 {return fetch_add(char16_t(1));}
9770 _LIBCPP_INLINE_VISIBILITY
9771 char16_t operator--(int) volatile
9772 {return fetch_sub(char16_t(1));}
9773 _LIBCPP_INLINE_VISIBILITY
9774 char16_t operator--(int)
9775 {return fetch_sub(char16_t(1));}
9776 _LIBCPP_INLINE_VISIBILITY
9777 char16_t operator++() volatile
9778 {return char16_t(fetch_add(char16_t(1)) + 1);}
9779 _LIBCPP_INLINE_VISIBILITY
9780 char16_t operator++()
9781 {return char16_t(fetch_add(char16_t(1)) + 1);}
9782 _LIBCPP_INLINE_VISIBILITY
9783 char16_t operator--() volatile
9784 {return char16_t(fetch_sub(char16_t(1)) - 1);}
9785 _LIBCPP_INLINE_VISIBILITY
9786 char16_t operator--()
9787 {return char16_t(fetch_sub(char16_t(1)) - 1);}
9788 _LIBCPP_INLINE_VISIBILITY
9789 char16_t operator+=(char16_t __v) volatile
9790 {return char16_t(fetch_add(__v) + __v);}
9791 _LIBCPP_INLINE_VISIBILITY
9792 char16_t operator+=(char16_t __v)
9793 {return char16_t(fetch_add(__v) + __v);}
9794 _LIBCPP_INLINE_VISIBILITY
9795 char16_t operator-=(char16_t __v) volatile
9796 {return char16_t(fetch_sub(__v) - __v);}
9797 _LIBCPP_INLINE_VISIBILITY
9798 char16_t operator-=(char16_t __v)
9799 {return char16_t(fetch_sub(__v) - __v);}
9800 _LIBCPP_INLINE_VISIBILITY
9801 char16_t operator&=(char16_t __v) volatile
9802 {return char16_t(fetch_and(__v) & __v);}
9803 _LIBCPP_INLINE_VISIBILITY
9804 char16_t operator&=(char16_t __v)
9805 {return char16_t(fetch_and(__v) & __v);}
9806 _LIBCPP_INLINE_VISIBILITY
9807 char16_t operator|=(char16_t __v) volatile
9808 {return char16_t(fetch_or(__v) | __v);}
9809 _LIBCPP_INLINE_VISIBILITY
9810 char16_t operator|=(char16_t __v)
9811 {return char16_t(fetch_or(__v) | __v);}
9812 _LIBCPP_INLINE_VISIBILITY
9813 char16_t operator^=(char16_t __v) volatile
9814 {return char16_t(fetch_xor(__v) ^ __v);}
9815 _LIBCPP_INLINE_VISIBILITY
9816 char16_t operator^=(char16_t __v)
9817 {return char16_t(fetch_xor(__v) ^ __v);}
9818} atomic_char16_t;
9819
9820inline _LIBCPP_INLINE_VISIBILITY
9821bool
9822atomic_is_lock_free(const volatile atomic_char16_t*)
9823{
9824 typedef char16_t type;
9825 return __atomic_is_lock_free(type);
9826}
9827
9828inline _LIBCPP_INLINE_VISIBILITY
9829bool
9830atomic_is_lock_free(const atomic_char16_t* __obj)
9831{
9832 return atomic_is_lock_free(const_cast<volatile atomic_char16_t*>(__obj));
9833}
9834
9835inline _LIBCPP_INLINE_VISIBILITY
9836void
9837atomic_init(volatile atomic_char16_t* __obj, char16_t __desr)
9838{
9839 __obj->__v_ = __desr;
9840}
9841
9842inline _LIBCPP_INLINE_VISIBILITY
9843void
9844atomic_init(atomic_char16_t* __obj, char16_t __desr)
9845{
9846 __obj->__v_ = __desr;
9847}
9848
9849inline _LIBCPP_INLINE_VISIBILITY
9850void
9851atomic_store(volatile atomic_char16_t* __obj, char16_t __desr)
9852{
9853 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
9854}
9855
9856inline _LIBCPP_INLINE_VISIBILITY
9857void
9858atomic_store(atomic_char16_t* __obj, char16_t __desr)
9859{
9860 atomic_store(const_cast<volatile atomic_char16_t*>(__obj), __desr);
9861}
9862
9863inline _LIBCPP_INLINE_VISIBILITY
9864void
9865atomic_store_explicit(volatile atomic_char16_t* __obj, char16_t __desr,
9866 memory_order __o)
9867{
9868 __atomic_store(&__obj->__v_, __desr, __o);
9869}
9870
9871inline _LIBCPP_INLINE_VISIBILITY
9872void
9873atomic_store_explicit(atomic_char16_t* __obj, char16_t __desr, memory_order __o)
9874{
9875 atomic_store_explicit(const_cast<volatile atomic_char16_t*>(__obj), __desr,
9876 __o);
9877}
9878
9879inline _LIBCPP_INLINE_VISIBILITY
9880char16_t
9881atomic_load(const volatile atomic_char16_t* __obj)
9882{
9883 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
9884}
9885
9886inline _LIBCPP_INLINE_VISIBILITY
9887char16_t
9888atomic_load(const atomic_char16_t* __obj)
9889{
9890 return atomic_load(const_cast<const volatile atomic_char16_t*>(__obj));
9891}
9892
9893inline _LIBCPP_INLINE_VISIBILITY
9894char16_t
9895atomic_load_explicit(const volatile atomic_char16_t* __obj, memory_order __o)
9896{
9897 return __atomic_load(&__obj->__v_, __o);
9898}
9899
9900inline _LIBCPP_INLINE_VISIBILITY
9901char16_t
9902atomic_load_explicit(const atomic_char16_t* __obj, memory_order __o)
9903{
9904 return atomic_load_explicit(const_cast<const volatile atomic_char16_t*>
9905 (__obj), __o);
9906}
9907
9908inline _LIBCPP_INLINE_VISIBILITY
9909char16_t
9910atomic_exchange(volatile atomic_char16_t* __obj, char16_t __desr)
9911{
9912 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
9913}
9914
9915inline _LIBCPP_INLINE_VISIBILITY
9916char16_t
9917atomic_exchange(atomic_char16_t* __obj, char16_t __desr)
9918{
9919 return atomic_exchange(const_cast<volatile atomic_char16_t*>(__obj), __desr);
9920}
9921
9922inline _LIBCPP_INLINE_VISIBILITY
9923char16_t
9924atomic_exchange_explicit(volatile atomic_char16_t* __obj, char16_t __desr,
9925 memory_order __o)
9926{
9927 return __atomic_exchange(&__obj->__v_, __desr, __o);
9928}
9929
9930inline _LIBCPP_INLINE_VISIBILITY
9931char16_t
9932atomic_exchange_explicit(atomic_char16_t* __obj, char16_t __desr,
9933 memory_order __o)
9934{
9935 return atomic_exchange_explicit(const_cast<volatile atomic_char16_t*>
9936 (__obj), __desr, __o);
9937}
9938
9939inline _LIBCPP_INLINE_VISIBILITY
9940bool
9941atomic_compare_exchange_weak(volatile atomic_char16_t* __obj, char16_t* __exp,
9942 char16_t __desr)
9943{
9944 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
9945 memory_order_seq_cst, memory_order_seq_cst);
9946}
9947
9948inline _LIBCPP_INLINE_VISIBILITY
9949bool
9950atomic_compare_exchange_weak(atomic_char16_t* __obj, char16_t* __exp,
9951 char16_t __desr)
9952{
9953 return atomic_compare_exchange_weak(const_cast<volatile atomic_char16_t*>
9954 (__obj), __exp, __desr);
9955}
9956
9957inline _LIBCPP_INLINE_VISIBILITY
9958bool
9959atomic_compare_exchange_strong(volatile atomic_char16_t* __obj, char16_t* __exp,
9960 char16_t __desr)
9961{
9962 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
9963 memory_order_seq_cst, memory_order_seq_cst);
9964}
9965
9966inline _LIBCPP_INLINE_VISIBILITY
9967bool
9968atomic_compare_exchange_strong(atomic_char16_t* __obj, char16_t* __exp,
9969 char16_t __desr)
9970{
9971 return atomic_compare_exchange_strong(const_cast<volatile atomic_char16_t*>
9972 (__obj), __exp, __desr);
9973}
9974
9975inline _LIBCPP_INLINE_VISIBILITY
9976bool
9977atomic_compare_exchange_weak_explicit(volatile atomic_char16_t* __obj,
9978 char16_t* __exp, char16_t __desr,
9979 memory_order __s, memory_order __f)
9980{
9981 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
9982 __f);
9983}
9984
9985inline _LIBCPP_INLINE_VISIBILITY
9986bool
9987atomic_compare_exchange_weak_explicit(atomic_char16_t* __obj, char16_t* __exp,
9988 char16_t __desr, memory_order __s,
9989 memory_order __f)
9990{
9991 return atomic_compare_exchange_weak_explicit(
9992 const_cast<volatile atomic_char16_t*>(__obj), __exp, __desr, __s, __f);
9993}
9994
9995inline _LIBCPP_INLINE_VISIBILITY
9996bool
9997atomic_compare_exchange_strong_explicit(volatile atomic_char16_t* __obj,
9998 char16_t* __exp, char16_t __desr,
9999 memory_order __s, memory_order __f)
10000{
10001 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
10002 __f);
10003}
10004
10005inline _LIBCPP_INLINE_VISIBILITY
10006bool
10007atomic_compare_exchange_strong_explicit(atomic_char16_t* __obj, char16_t* __exp,
10008 char16_t __desr, memory_order __s,
10009 memory_order __f)
10010{
10011 return atomic_compare_exchange_strong_explicit(
10012 const_cast<volatile atomic_char16_t*>(__obj), __exp, __desr, __s, __f);
10013}
10014
10015inline _LIBCPP_INLINE_VISIBILITY
10016char16_t
10017atomic_fetch_add(volatile atomic_char16_t* __obj, char16_t __v)
10018{
10019 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
10020}
10021
10022inline _LIBCPP_INLINE_VISIBILITY
10023char16_t
10024atomic_fetch_add(atomic_char16_t* __obj, char16_t __v)
10025{
10026 return atomic_fetch_add(const_cast<volatile atomic_char16_t*>(__obj), __v);
10027}
10028
10029inline _LIBCPP_INLINE_VISIBILITY
10030char16_t
10031atomic_fetch_add_explicit(volatile atomic_char16_t* __obj, char16_t __v,
10032 memory_order __o)
10033{
10034 return __atomic_fetch_add(&__obj->__v_, __v, __o);
10035}
10036
10037inline _LIBCPP_INLINE_VISIBILITY
10038char16_t
10039atomic_fetch_add_explicit(atomic_char16_t* __obj, char16_t __v,
10040 memory_order __o)
10041{
10042 return atomic_fetch_add_explicit(const_cast<volatile atomic_char16_t*>(__obj),
10043 __v, __o);
10044}
10045
10046inline _LIBCPP_INLINE_VISIBILITY
10047char16_t
10048atomic_fetch_sub(volatile atomic_char16_t* __obj, char16_t __v)
10049{
10050 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
10051}
10052
10053inline _LIBCPP_INLINE_VISIBILITY
10054char16_t
10055atomic_fetch_sub(atomic_char16_t* __obj, char16_t __v)
10056{
10057 return atomic_fetch_sub(const_cast<volatile atomic_char16_t*>(__obj), __v);
10058}
10059
10060inline _LIBCPP_INLINE_VISIBILITY
10061char16_t
10062atomic_fetch_sub_explicit(volatile atomic_char16_t* __obj, char16_t __v,
10063 memory_order __o)
10064{
10065 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
10066}
10067
10068inline _LIBCPP_INLINE_VISIBILITY
10069char16_t
10070atomic_fetch_sub_explicit(atomic_char16_t* __obj, char16_t __v,
10071 memory_order __o)
10072{
10073 return atomic_fetch_sub_explicit(const_cast<volatile atomic_char16_t*>(__obj),
10074 __v, __o);
10075}
10076
10077inline _LIBCPP_INLINE_VISIBILITY
10078char16_t
10079atomic_fetch_and(volatile atomic_char16_t* __obj, char16_t __v)
10080{
10081 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
10082}
10083
10084inline _LIBCPP_INLINE_VISIBILITY
10085char16_t
10086atomic_fetch_and(atomic_char16_t* __obj, char16_t __v)
10087{
10088 return atomic_fetch_and(const_cast<volatile atomic_char16_t*>(__obj), __v);
10089}
10090
10091inline _LIBCPP_INLINE_VISIBILITY
10092char16_t
10093atomic_fetch_and_explicit(volatile atomic_char16_t* __obj, char16_t __v,
10094 memory_order __o)
10095{
10096 return __atomic_fetch_and(&__obj->__v_, __v, __o);
10097}
10098
10099inline _LIBCPP_INLINE_VISIBILITY
10100char16_t
10101atomic_fetch_and_explicit(atomic_char16_t* __obj, char16_t __v,
10102 memory_order __o)
10103{
10104 return atomic_fetch_and_explicit(const_cast<volatile atomic_char16_t*>(__obj),
10105 __v, __o);
10106}
10107
10108inline _LIBCPP_INLINE_VISIBILITY
10109char16_t
10110atomic_fetch_or(volatile atomic_char16_t* __obj, char16_t __v)
10111{
10112 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
10113}
10114
10115inline _LIBCPP_INLINE_VISIBILITY
10116char16_t
10117atomic_fetch_or(atomic_char16_t* __obj, char16_t __v)
10118{
10119 return atomic_fetch_or(const_cast<volatile atomic_char16_t*>(__obj), __v);
10120}
10121
10122inline _LIBCPP_INLINE_VISIBILITY
10123char16_t
10124atomic_fetch_or_explicit(volatile atomic_char16_t* __obj, char16_t __v,
10125 memory_order __o)
10126{
10127 return __atomic_fetch_or(&__obj->__v_, __v, __o);
10128}
10129
10130inline _LIBCPP_INLINE_VISIBILITY
10131char16_t
10132atomic_fetch_or_explicit(atomic_char16_t* __obj, char16_t __v, memory_order __o)
10133{
10134 return atomic_fetch_or_explicit(const_cast<volatile atomic_char16_t*>(__obj),
10135 __v, __o);
10136}
10137
10138inline _LIBCPP_INLINE_VISIBILITY
10139char16_t
10140atomic_fetch_xor(volatile atomic_char16_t* __obj, char16_t __v)
10141{
10142 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
10143}
10144
10145inline _LIBCPP_INLINE_VISIBILITY
10146char16_t
10147atomic_fetch_xor(atomic_char16_t* __obj, char16_t __v)
10148{
10149 return atomic_fetch_xor(const_cast<volatile atomic_char16_t*>(__obj), __v);
10150}
10151
10152inline _LIBCPP_INLINE_VISIBILITY
10153char16_t
10154atomic_fetch_xor_explicit(volatile atomic_char16_t* __obj, char16_t __v,
10155 memory_order __o)
10156{
10157 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
10158}
10159
10160inline _LIBCPP_INLINE_VISIBILITY
10161char16_t
10162atomic_fetch_xor_explicit(atomic_char16_t* __obj, char16_t __v,
10163 memory_order __o)
10164{
10165 return atomic_fetch_xor_explicit(const_cast<volatile atomic_char16_t*>(__obj),
10166 __v, __o);
10167}
10168
10169// atomic_char32_t
10170
10171struct atomic_char32_t;
10172
10173bool atomic_is_lock_free(const volatile atomic_char32_t*);
10174bool atomic_is_lock_free(const atomic_char32_t*);
10175void atomic_init(volatile atomic_char32_t*, char32_t);
10176void atomic_init(atomic_char32_t*, char32_t);
10177void atomic_store(volatile atomic_char32_t*, char32_t);
10178void atomic_store(atomic_char32_t*, char32_t);
10179void atomic_store_explicit(volatile atomic_char32_t*, char32_t, memory_order);
10180void atomic_store_explicit(atomic_char32_t*, char32_t, memory_order);
10181char32_t atomic_load(const volatile atomic_char32_t*);
10182char32_t atomic_load(const atomic_char32_t*);
10183char32_t atomic_load_explicit(const volatile atomic_char32_t*, memory_order);
10184char32_t atomic_load_explicit(const atomic_char32_t*, memory_order);
10185char32_t atomic_exchange(volatile atomic_char32_t*, char32_t);
10186char32_t atomic_exchange(atomic_char32_t*, char32_t);
10187char32_t atomic_exchange_explicit(volatile atomic_char32_t*, char32_t,
10188 memory_order);
10189char32_t atomic_exchange_explicit(atomic_char32_t*, char32_t, memory_order);
10190bool atomic_compare_exchange_weak(volatile atomic_char32_t*, char32_t*,
10191 char32_t);
10192bool atomic_compare_exchange_weak(atomic_char32_t*, char32_t*, char32_t);
10193bool atomic_compare_exchange_strong(volatile atomic_char32_t*, char32_t*,
10194 char32_t);
10195bool atomic_compare_exchange_strong(atomic_char32_t*, char32_t*, char32_t);
10196bool atomic_compare_exchange_weak_explicit(volatile atomic_char32_t*, char32_t*,
10197 char32_t, memory_order,
10198 memory_order);
10199bool atomic_compare_exchange_weak_explicit(atomic_char32_t*, char32_t*,
10200 char32_t, memory_order,
10201 memory_order);
10202bool atomic_compare_exchange_strong_explicit(volatile atomic_char32_t*,
10203 char32_t*, char32_t, memory_order,
10204 memory_order);
10205bool atomic_compare_exchange_strong_explicit(atomic_char32_t*, char32_t*,
10206 char32_t, memory_order,
10207 memory_order);
10208char32_t atomic_fetch_add(volatile atomic_char32_t*, char32_t);
10209char32_t atomic_fetch_add(atomic_char32_t*, char32_t);
10210char32_t atomic_fetch_add_explicit(volatile atomic_char32_t*, char32_t,
10211 memory_order);
10212char32_t atomic_fetch_add_explicit(atomic_char32_t*, char32_t, memory_order);
10213char32_t atomic_fetch_sub(volatile atomic_char32_t*, char32_t);
10214char32_t atomic_fetch_sub(atomic_char32_t*, char32_t);
10215char32_t atomic_fetch_sub_explicit(volatile atomic_char32_t*, char32_t,
10216 memory_order);
10217char32_t atomic_fetch_sub_explicit(atomic_char32_t*, char32_t, memory_order);
10218char32_t atomic_fetch_and(volatile atomic_char32_t*, char32_t);
10219char32_t atomic_fetch_and(atomic_char32_t*, char32_t);
10220char32_t atomic_fetch_and_explicit(volatile atomic_char32_t*, char32_t,
10221 memory_order);
10222char32_t atomic_fetch_and_explicit(atomic_char32_t*, char32_t, memory_order);
10223char32_t atomic_fetch_or(volatile atomic_char32_t*, char32_t);
10224char32_t atomic_fetch_or(atomic_char32_t*, char32_t);
10225char32_t atomic_fetch_or_explicit(volatile atomic_char32_t*, char32_t,
10226 memory_order);
10227char32_t atomic_fetch_or_explicit(atomic_char32_t*, char32_t, memory_order);
10228char32_t atomic_fetch_xor(volatile atomic_char32_t*, char32_t);
10229char32_t atomic_fetch_xor(atomic_char32_t*, char32_t);
10230char32_t atomic_fetch_xor_explicit(volatile atomic_char32_t*, char32_t,
10231 memory_order);
10232char32_t atomic_fetch_xor_explicit(atomic_char32_t*, char32_t, memory_order);
10233
10234typedef struct atomic_char32_t
10235{
10236 char32_t __v_;
10237
10238 _LIBCPP_INLINE_VISIBILITY
10239 bool is_lock_free() const volatile
10240 {return atomic_is_lock_free(this);}
10241 _LIBCPP_INLINE_VISIBILITY
10242 bool is_lock_free() const
10243 {return atomic_is_lock_free(this);}
10244 _LIBCPP_INLINE_VISIBILITY
10245 void store(char32_t __v, memory_order __o = memory_order_seq_cst) volatile
10246 {atomic_store_explicit(this, __v, __o);}
10247 _LIBCPP_INLINE_VISIBILITY
10248 void store(char32_t __v, memory_order __o = memory_order_seq_cst)
10249 {atomic_store_explicit(this, __v, __o);}
10250 _LIBCPP_INLINE_VISIBILITY
10251 char32_t load(memory_order __o = memory_order_seq_cst) const volatile
10252 {return atomic_load_explicit(this, __o);}
10253 _LIBCPP_INLINE_VISIBILITY
10254 char32_t load(memory_order __o = memory_order_seq_cst) const
10255 {return atomic_load_explicit(this, __o);}
10256 _LIBCPP_INLINE_VISIBILITY
10257 operator char32_t() const volatile
10258 {return load();}
10259 _LIBCPP_INLINE_VISIBILITY
10260 operator char32_t() const
10261 {return load();}
10262 _LIBCPP_INLINE_VISIBILITY
10263 char32_t exchange(char32_t __v,
10264 memory_order __o = memory_order_seq_cst) volatile
10265 {return atomic_exchange_explicit(this, __v, __o);}
10266 _LIBCPP_INLINE_VISIBILITY
10267 char32_t exchange(char32_t __v, memory_order __o = memory_order_seq_cst)
10268 {return atomic_exchange_explicit(this, __v, __o);}
10269 _LIBCPP_INLINE_VISIBILITY
10270 bool compare_exchange_weak(char32_t& __v, char32_t __e, memory_order __s,
10271 memory_order __f) volatile
10272 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
10273 __f);}
10274 _LIBCPP_INLINE_VISIBILITY
10275 bool compare_exchange_weak(char32_t& __v, char32_t __e, memory_order __s,
10276 memory_order __f)
10277 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
10278 __f);}
10279 _LIBCPP_INLINE_VISIBILITY
10280 bool compare_exchange_strong(char32_t& __v, char32_t __e, memory_order __s,
10281 memory_order __f) volatile
10282 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
10283 __f);}
10284 _LIBCPP_INLINE_VISIBILITY
10285 bool compare_exchange_strong(char32_t& __v, char32_t __e, memory_order __s,
10286 memory_order __f)
10287 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
10288 __f);}
10289 _LIBCPP_INLINE_VISIBILITY
10290 bool compare_exchange_weak(char32_t& __v, char32_t __e,
10291 memory_order __s = memory_order_seq_cst) volatile
10292 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
10293 __translate_memory_order(__s));}
10294 _LIBCPP_INLINE_VISIBILITY
10295 bool compare_exchange_weak(char32_t& __v, char32_t __e,
10296 memory_order __s = memory_order_seq_cst)
10297 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
10298 __translate_memory_order(__s));}
10299 _LIBCPP_INLINE_VISIBILITY
10300 bool compare_exchange_strong(char32_t& __v, char32_t __e,
10301 memory_order __s = memory_order_seq_cst) volatile
10302 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
10303 __translate_memory_order(__s));}
10304 _LIBCPP_INLINE_VISIBILITY
10305 bool compare_exchange_strong(char32_t& __v, char32_t __e,
10306 memory_order __s = memory_order_seq_cst)
10307 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
10308 __translate_memory_order(__s));}
10309 _LIBCPP_INLINE_VISIBILITY
10310 char32_t fetch_add(char32_t __v,
10311 memory_order __o = memory_order_seq_cst) volatile
10312 {return atomic_fetch_add_explicit(this, __v, __o);}
10313 _LIBCPP_INLINE_VISIBILITY
10314 char32_t fetch_add(char32_t __v, memory_order __o = memory_order_seq_cst)
10315 {return atomic_fetch_add_explicit(this, __v, __o);}
10316 _LIBCPP_INLINE_VISIBILITY
10317 char32_t fetch_sub(char32_t __v,
10318 memory_order __o = memory_order_seq_cst) volatile
10319 {return atomic_fetch_sub_explicit(this, __v, __o);}
10320 _LIBCPP_INLINE_VISIBILITY
10321 char32_t fetch_sub(char32_t __v, memory_order __o = memory_order_seq_cst)
10322 {return atomic_fetch_sub_explicit(this, __v, __o);}
10323 _LIBCPP_INLINE_VISIBILITY
10324 char32_t fetch_and(char32_t __v,
10325 memory_order __o = memory_order_seq_cst) volatile
10326 {return atomic_fetch_and_explicit(this, __v, __o);}
10327 _LIBCPP_INLINE_VISIBILITY
10328 char32_t fetch_and(char32_t __v, memory_order __o = memory_order_seq_cst)
10329 {return atomic_fetch_and_explicit(this, __v, __o);}
10330 _LIBCPP_INLINE_VISIBILITY
10331 char32_t fetch_or(char32_t __v,
10332 memory_order __o = memory_order_seq_cst) volatile
10333 {return atomic_fetch_or_explicit(this, __v, __o);}
10334 _LIBCPP_INLINE_VISIBILITY
10335 char32_t fetch_or(char32_t __v, memory_order __o = memory_order_seq_cst)
10336 {return atomic_fetch_or_explicit(this, __v, __o);}
10337 _LIBCPP_INLINE_VISIBILITY
10338 char32_t fetch_xor(char32_t __v,
10339 memory_order __o = memory_order_seq_cst) volatile
10340 {return atomic_fetch_xor_explicit(this, __v, __o);}
10341 _LIBCPP_INLINE_VISIBILITY
10342 char32_t fetch_xor(char32_t __v, memory_order __o = memory_order_seq_cst)
10343 {return atomic_fetch_xor_explicit(this, __v, __o);}
10344#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
10345 atomic_char32_t() = default;
10346#else
10347 _LIBCPP_INLINE_VISIBILITY
10348 atomic_char32_t() {}
10349#endif
10350 _LIBCPP_INLINE_VISIBILITY
10351 /*constexpr*/ atomic_char32_t(char32_t __v)
10352 : __v_(__v) {}
10353#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
10354 atomic_char32_t(const atomic_char32_t&) = delete;
10355 atomic_char32_t& operator=(const atomic_char32_t&) = delete;
10356 atomic_char32_t& operator=(const atomic_char32_t&) volatile = delete;
10357#else
10358private:
10359 atomic_char32_t(const atomic_char32_t&);
10360 atomic_char32_t& operator=(const atomic_char32_t&);
10361 atomic_char32_t& operator=(const atomic_char32_t&) volatile;
10362public:
10363#endif
10364 _LIBCPP_INLINE_VISIBILITY
10365 char32_t operator=(char32_t __v) volatile
10366 {store(__v); return __v;}
10367 _LIBCPP_INLINE_VISIBILITY
10368 char32_t operator=(char32_t __v)
10369 {store(__v); return __v;}
10370 _LIBCPP_INLINE_VISIBILITY
10371 char32_t operator++(int) volatile
10372 {return fetch_add(char32_t(1));}
10373 _LIBCPP_INLINE_VISIBILITY
10374 char32_t operator++(int)
10375 {return fetch_add(char32_t(1));}
10376 _LIBCPP_INLINE_VISIBILITY
10377 char32_t operator--(int) volatile
10378 {return fetch_sub(char32_t(1));}
10379 _LIBCPP_INLINE_VISIBILITY
10380 char32_t operator--(int)
10381 {return fetch_sub(char32_t(1));}
10382 _LIBCPP_INLINE_VISIBILITY
10383 char32_t operator++() volatile
10384 {return char32_t(fetch_add(char32_t(1)) + 1);}
10385 _LIBCPP_INLINE_VISIBILITY
10386 char32_t operator++()
10387 {return char32_t(fetch_add(char32_t(1)) + 1);}
10388 _LIBCPP_INLINE_VISIBILITY
10389 char32_t operator--() volatile
10390 {return char32_t(fetch_sub(char32_t(1)) - 1);}
10391 _LIBCPP_INLINE_VISIBILITY
10392 char32_t operator--()
10393 {return char32_t(fetch_sub(char32_t(1)) - 1);}
10394 _LIBCPP_INLINE_VISIBILITY
10395 char32_t operator+=(char32_t __v) volatile
10396 {return char32_t(fetch_add(__v) + __v);}
10397 _LIBCPP_INLINE_VISIBILITY
10398 char32_t operator+=(char32_t __v)
10399 {return char32_t(fetch_add(__v) + __v);}
10400 _LIBCPP_INLINE_VISIBILITY
10401 char32_t operator-=(char32_t __v) volatile
10402 {return char32_t(fetch_sub(__v) - __v);}
10403 _LIBCPP_INLINE_VISIBILITY
10404 char32_t operator-=(char32_t __v)
10405 {return char32_t(fetch_sub(__v) - __v);}
10406 _LIBCPP_INLINE_VISIBILITY
10407 char32_t operator&=(char32_t __v) volatile
10408 {return char32_t(fetch_and(__v) & __v);}
10409 _LIBCPP_INLINE_VISIBILITY
10410 char32_t operator&=(char32_t __v)
10411 {return char32_t(fetch_and(__v) & __v);}
10412 _LIBCPP_INLINE_VISIBILITY
10413 char32_t operator|=(char32_t __v) volatile
10414 {return char32_t(fetch_or(__v) | __v);}
10415 _LIBCPP_INLINE_VISIBILITY
10416 char32_t operator|=(char32_t __v)
10417 {return char32_t(fetch_or(__v) | __v);}
10418 _LIBCPP_INLINE_VISIBILITY
10419 char32_t operator^=(char32_t __v) volatile
10420 {return char32_t(fetch_xor(__v) ^ __v);}
10421 _LIBCPP_INLINE_VISIBILITY
10422 char32_t operator^=(char32_t __v)
10423 {return char32_t(fetch_xor(__v) ^ __v);}
10424} atomic_char32_t;
10425
10426inline _LIBCPP_INLINE_VISIBILITY
10427bool
10428atomic_is_lock_free(const volatile atomic_char32_t*)
10429{
10430 typedef char32_t type;
10431 return __atomic_is_lock_free(type);
10432}
10433
10434inline _LIBCPP_INLINE_VISIBILITY
10435bool
10436atomic_is_lock_free(const atomic_char32_t* __obj)
10437{
10438 return atomic_is_lock_free(const_cast<volatile atomic_char32_t*>(__obj));
10439}
10440
10441inline _LIBCPP_INLINE_VISIBILITY
10442void
10443atomic_init(volatile atomic_char32_t* __obj, char32_t __desr)
10444{
10445 __obj->__v_ = __desr;
10446}
10447
10448inline _LIBCPP_INLINE_VISIBILITY
10449void
10450atomic_init(atomic_char32_t* __obj, char32_t __desr)
10451{
10452 __obj->__v_ = __desr;
10453}
10454
10455inline _LIBCPP_INLINE_VISIBILITY
10456void
10457atomic_store(volatile atomic_char32_t* __obj, char32_t __desr)
10458{
10459 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
10460}
10461
10462inline _LIBCPP_INLINE_VISIBILITY
10463void
10464atomic_store(atomic_char32_t* __obj, char32_t __desr)
10465{
10466 atomic_store(const_cast<volatile atomic_char32_t*>(__obj), __desr);
10467}
10468
10469inline _LIBCPP_INLINE_VISIBILITY
10470void
10471atomic_store_explicit(volatile atomic_char32_t* __obj, char32_t __desr,
10472 memory_order __o)
10473{
10474 __atomic_store(&__obj->__v_, __desr, __o);
10475}
10476
10477inline _LIBCPP_INLINE_VISIBILITY
10478void
10479atomic_store_explicit(atomic_char32_t* __obj, char32_t __desr, memory_order __o)
10480{
10481 atomic_store_explicit(const_cast<volatile atomic_char32_t*>(__obj), __desr,
10482 __o);
10483}
10484
10485inline _LIBCPP_INLINE_VISIBILITY
10486char32_t
10487atomic_load(const volatile atomic_char32_t* __obj)
10488{
10489 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
10490}
10491
10492inline _LIBCPP_INLINE_VISIBILITY
10493char32_t
10494atomic_load(const atomic_char32_t* __obj)
10495{
10496 return atomic_load(const_cast<const volatile atomic_char32_t*>(__obj));
10497}
10498
10499inline _LIBCPP_INLINE_VISIBILITY
10500char32_t
10501atomic_load_explicit(const volatile atomic_char32_t* __obj, memory_order __o)
10502{
10503 return __atomic_load(&__obj->__v_, __o);
10504}
10505
10506inline _LIBCPP_INLINE_VISIBILITY
10507char32_t
10508atomic_load_explicit(const atomic_char32_t* __obj, memory_order __o)
10509{
10510 return atomic_load_explicit(const_cast<const volatile atomic_char32_t*>
10511 (__obj), __o);
10512}
10513
10514inline _LIBCPP_INLINE_VISIBILITY
10515char32_t
10516atomic_exchange(volatile atomic_char32_t* __obj, char32_t __desr)
10517{
10518 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
10519}
10520
10521inline _LIBCPP_INLINE_VISIBILITY
10522char32_t
10523atomic_exchange(atomic_char32_t* __obj, char32_t __desr)
10524{
10525 return atomic_exchange(const_cast<volatile atomic_char32_t*>(__obj), __desr);
10526}
10527
10528inline _LIBCPP_INLINE_VISIBILITY
10529char32_t
10530atomic_exchange_explicit(volatile atomic_char32_t* __obj, char32_t __desr,
10531 memory_order __o)
10532{
10533 return __atomic_exchange(&__obj->__v_, __desr, __o);
10534}
10535
10536inline _LIBCPP_INLINE_VISIBILITY
10537char32_t
10538atomic_exchange_explicit(atomic_char32_t* __obj, char32_t __desr,
10539 memory_order __o)
10540{
10541 return atomic_exchange_explicit(const_cast<volatile atomic_char32_t*>
10542 (__obj), __desr, __o);
10543}
10544
10545inline _LIBCPP_INLINE_VISIBILITY
10546bool
10547atomic_compare_exchange_weak(volatile atomic_char32_t* __obj, char32_t* __exp,
10548 char32_t __desr)
10549{
10550 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
10551 memory_order_seq_cst, memory_order_seq_cst);
10552}
10553
10554inline _LIBCPP_INLINE_VISIBILITY
10555bool
10556atomic_compare_exchange_weak(atomic_char32_t* __obj, char32_t* __exp,
10557 char32_t __desr)
10558{
10559 return atomic_compare_exchange_weak(const_cast<volatile atomic_char32_t*>
10560 (__obj), __exp, __desr);
10561}
10562
10563inline _LIBCPP_INLINE_VISIBILITY
10564bool
10565atomic_compare_exchange_strong(volatile atomic_char32_t* __obj, char32_t* __exp,
10566 char32_t __desr)
10567{
10568 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
10569 memory_order_seq_cst, memory_order_seq_cst);
10570}
10571
10572inline _LIBCPP_INLINE_VISIBILITY
10573bool
10574atomic_compare_exchange_strong(atomic_char32_t* __obj, char32_t* __exp,
10575 char32_t __desr)
10576{
10577 return atomic_compare_exchange_strong(const_cast<volatile atomic_char32_t*>
10578 (__obj), __exp, __desr);
10579}
10580
10581inline _LIBCPP_INLINE_VISIBILITY
10582bool
10583atomic_compare_exchange_weak_explicit(volatile atomic_char32_t* __obj,
10584 char32_t* __exp, char32_t __desr,
10585 memory_order __s, memory_order __f)
10586{
10587 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
10588 __f);
10589}
10590
10591inline _LIBCPP_INLINE_VISIBILITY
10592bool
10593atomic_compare_exchange_weak_explicit(atomic_char32_t* __obj, char32_t* __exp,
10594 char32_t __desr, memory_order __s,
10595 memory_order __f)
10596{
10597 return atomic_compare_exchange_weak_explicit(
10598 const_cast<volatile atomic_char32_t*>(__obj), __exp, __desr, __s, __f);
10599}
10600
10601inline _LIBCPP_INLINE_VISIBILITY
10602bool
10603atomic_compare_exchange_strong_explicit(volatile atomic_char32_t* __obj,
10604 char32_t* __exp, char32_t __desr,
10605 memory_order __s, memory_order __f)
10606{
10607 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
10608 __f);
10609}
10610
10611inline _LIBCPP_INLINE_VISIBILITY
10612bool
10613atomic_compare_exchange_strong_explicit(atomic_char32_t* __obj, char32_t* __exp,
10614 char32_t __desr, memory_order __s,
10615 memory_order __f)
10616{
10617 return atomic_compare_exchange_strong_explicit(
10618 const_cast<volatile atomic_char32_t*>(__obj), __exp, __desr, __s, __f);
10619}
10620
10621inline _LIBCPP_INLINE_VISIBILITY
10622char32_t
10623atomic_fetch_add(volatile atomic_char32_t* __obj, char32_t __v)
10624{
10625 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
10626}
10627
10628inline _LIBCPP_INLINE_VISIBILITY
10629char32_t
10630atomic_fetch_add(atomic_char32_t* __obj, char32_t __v)
10631{
10632 return atomic_fetch_add(const_cast<volatile atomic_char32_t*>(__obj), __v);
10633}
10634
10635inline _LIBCPP_INLINE_VISIBILITY
10636char32_t
10637atomic_fetch_add_explicit(volatile atomic_char32_t* __obj, char32_t __v,
10638 memory_order __o)
10639{
10640 return __atomic_fetch_add(&__obj->__v_, __v, __o);
10641}
10642
10643inline _LIBCPP_INLINE_VISIBILITY
10644char32_t
10645atomic_fetch_add_explicit(atomic_char32_t* __obj, char32_t __v,
10646 memory_order __o)
10647{
10648 return atomic_fetch_add_explicit(const_cast<volatile atomic_char32_t*>(__obj),
10649 __v, __o);
10650}
10651
10652inline _LIBCPP_INLINE_VISIBILITY
10653char32_t
10654atomic_fetch_sub(volatile atomic_char32_t* __obj, char32_t __v)
10655{
10656 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
10657}
10658
10659inline _LIBCPP_INLINE_VISIBILITY
10660char32_t
10661atomic_fetch_sub(atomic_char32_t* __obj, char32_t __v)
10662{
10663 return atomic_fetch_sub(const_cast<volatile atomic_char32_t*>(__obj), __v);
10664}
10665
10666inline _LIBCPP_INLINE_VISIBILITY
10667char32_t
10668atomic_fetch_sub_explicit(volatile atomic_char32_t* __obj, char32_t __v,
10669 memory_order __o)
10670{
10671 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
10672}
10673
10674inline _LIBCPP_INLINE_VISIBILITY
10675char32_t
10676atomic_fetch_sub_explicit(atomic_char32_t* __obj, char32_t __v,
10677 memory_order __o)
10678{
10679 return atomic_fetch_sub_explicit(const_cast<volatile atomic_char32_t*>(__obj),
10680 __v, __o);
10681}
10682
10683inline _LIBCPP_INLINE_VISIBILITY
10684char32_t
10685atomic_fetch_and(volatile atomic_char32_t* __obj, char32_t __v)
10686{
10687 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
10688}
10689
10690inline _LIBCPP_INLINE_VISIBILITY
10691char32_t
10692atomic_fetch_and(atomic_char32_t* __obj, char32_t __v)
10693{
10694 return atomic_fetch_and(const_cast<volatile atomic_char32_t*>(__obj), __v);
10695}
10696
10697inline _LIBCPP_INLINE_VISIBILITY
10698char32_t
10699atomic_fetch_and_explicit(volatile atomic_char32_t* __obj, char32_t __v,
10700 memory_order __o)
10701{
10702 return __atomic_fetch_and(&__obj->__v_, __v, __o);
10703}
10704
10705inline _LIBCPP_INLINE_VISIBILITY
10706char32_t
10707atomic_fetch_and_explicit(atomic_char32_t* __obj, char32_t __v,
10708 memory_order __o)
10709{
10710 return atomic_fetch_and_explicit(const_cast<volatile atomic_char32_t*>(__obj),
10711 __v, __o);
10712}
10713
10714inline _LIBCPP_INLINE_VISIBILITY
10715char32_t
10716atomic_fetch_or(volatile atomic_char32_t* __obj, char32_t __v)
10717{
10718 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
10719}
10720
10721inline _LIBCPP_INLINE_VISIBILITY
10722char32_t
10723atomic_fetch_or(atomic_char32_t* __obj, char32_t __v)
10724{
10725 return atomic_fetch_or(const_cast<volatile atomic_char32_t*>(__obj), __v);
10726}
10727
10728inline _LIBCPP_INLINE_VISIBILITY
10729char32_t
10730atomic_fetch_or_explicit(volatile atomic_char32_t* __obj, char32_t __v,
10731 memory_order __o)
10732{
10733 return __atomic_fetch_or(&__obj->__v_, __v, __o);
10734}
10735
10736inline _LIBCPP_INLINE_VISIBILITY
10737char32_t
10738atomic_fetch_or_explicit(atomic_char32_t* __obj, char32_t __v, memory_order __o)
10739{
10740 return atomic_fetch_or_explicit(const_cast<volatile atomic_char32_t*>(__obj),
10741 __v, __o);
10742}
10743
10744inline _LIBCPP_INLINE_VISIBILITY
10745char32_t
10746atomic_fetch_xor(volatile atomic_char32_t* __obj, char32_t __v)
10747{
10748 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
10749}
10750
10751inline _LIBCPP_INLINE_VISIBILITY
10752char32_t
10753atomic_fetch_xor(atomic_char32_t* __obj, char32_t __v)
10754{
10755 return atomic_fetch_xor(const_cast<volatile atomic_char32_t*>(__obj), __v);
10756}
10757
10758inline _LIBCPP_INLINE_VISIBILITY
10759char32_t
10760atomic_fetch_xor_explicit(volatile atomic_char32_t* __obj, char32_t __v,
10761 memory_order __o)
10762{
10763 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
10764}
10765
10766inline _LIBCPP_INLINE_VISIBILITY
10767char32_t
10768atomic_fetch_xor_explicit(atomic_char32_t* __obj, char32_t __v,
10769 memory_order __o)
10770{
10771 return atomic_fetch_xor_explicit(const_cast<volatile atomic_char32_t*>(__obj),
10772 __v, __o);
10773}
10774
10775#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
10776
10777// atomic_wchar_t
10778
10779struct atomic_wchar_t;
10780
10781bool atomic_is_lock_free(const volatile atomic_wchar_t*);
10782bool atomic_is_lock_free(const atomic_wchar_t*);
10783void atomic_init(volatile atomic_wchar_t*, wchar_t);
10784void atomic_init(atomic_wchar_t*, wchar_t);
10785void atomic_store(volatile atomic_wchar_t*, wchar_t);
10786void atomic_store(atomic_wchar_t*, wchar_t);
10787void atomic_store_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
10788void atomic_store_explicit(atomic_wchar_t*, wchar_t, memory_order);
10789wchar_t atomic_load(const volatile atomic_wchar_t*);
10790wchar_t atomic_load(const atomic_wchar_t*);
10791wchar_t atomic_load_explicit(const volatile atomic_wchar_t*, memory_order);
10792wchar_t atomic_load_explicit(const atomic_wchar_t*, memory_order);
10793wchar_t atomic_exchange(volatile atomic_wchar_t*, wchar_t);
10794wchar_t atomic_exchange(atomic_wchar_t*, wchar_t);
10795wchar_t atomic_exchange_explicit(volatile atomic_wchar_t*, wchar_t,
10796 memory_order);
10797wchar_t atomic_exchange_explicit(atomic_wchar_t*, wchar_t, memory_order);
10798bool atomic_compare_exchange_weak(volatile atomic_wchar_t*, wchar_t*,
10799 wchar_t);
10800bool atomic_compare_exchange_weak(atomic_wchar_t*, wchar_t*, wchar_t);
10801bool atomic_compare_exchange_strong(volatile atomic_wchar_t*, wchar_t*,
10802 wchar_t);
10803bool atomic_compare_exchange_strong(atomic_wchar_t*, wchar_t*, wchar_t);
10804bool atomic_compare_exchange_weak_explicit(volatile atomic_wchar_t*, wchar_t*,
10805 wchar_t, memory_order,
10806 memory_order);
10807bool atomic_compare_exchange_weak_explicit(atomic_wchar_t*, wchar_t*,
10808 wchar_t, memory_order,
10809 memory_order);
10810bool atomic_compare_exchange_strong_explicit(volatile atomic_wchar_t*,
10811 wchar_t*, wchar_t, memory_order,
10812 memory_order);
10813bool atomic_compare_exchange_strong_explicit(atomic_wchar_t*, wchar_t*,
10814 wchar_t, memory_order,
10815 memory_order);
10816wchar_t atomic_fetch_add(volatile atomic_wchar_t*, wchar_t);
10817wchar_t atomic_fetch_add(atomic_wchar_t*, wchar_t);
10818wchar_t atomic_fetch_add_explicit(volatile atomic_wchar_t*, wchar_t,
10819 memory_order);
10820wchar_t atomic_fetch_add_explicit(atomic_wchar_t*, wchar_t, memory_order);
10821wchar_t atomic_fetch_sub(volatile atomic_wchar_t*, wchar_t);
10822wchar_t atomic_fetch_sub(atomic_wchar_t*, wchar_t);
10823wchar_t atomic_fetch_sub_explicit(volatile atomic_wchar_t*, wchar_t,
10824 memory_order);
10825wchar_t atomic_fetch_sub_explicit(atomic_wchar_t*, wchar_t, memory_order);
10826wchar_t atomic_fetch_and(volatile atomic_wchar_t*, wchar_t);
10827wchar_t atomic_fetch_and(atomic_wchar_t*, wchar_t);
10828wchar_t atomic_fetch_and_explicit(volatile atomic_wchar_t*, wchar_t,
10829 memory_order);
10830wchar_t atomic_fetch_and_explicit(atomic_wchar_t*, wchar_t, memory_order);
10831wchar_t atomic_fetch_or(volatile atomic_wchar_t*, wchar_t);
10832wchar_t atomic_fetch_or(atomic_wchar_t*, wchar_t);
10833wchar_t atomic_fetch_or_explicit(volatile atomic_wchar_t*, wchar_t,
10834 memory_order);
10835wchar_t atomic_fetch_or_explicit(atomic_wchar_t*, wchar_t, memory_order);
10836wchar_t atomic_fetch_xor(volatile atomic_wchar_t*, wchar_t);
10837wchar_t atomic_fetch_xor(atomic_wchar_t*, wchar_t);
10838wchar_t atomic_fetch_xor_explicit(volatile atomic_wchar_t*, wchar_t,
10839 memory_order);
10840wchar_t atomic_fetch_xor_explicit(atomic_wchar_t*, wchar_t, memory_order);
10841
10842typedef struct atomic_wchar_t
10843{
10844 wchar_t __v_;
10845
10846 _LIBCPP_INLINE_VISIBILITY
10847 bool is_lock_free() const volatile
10848 {return atomic_is_lock_free(this);}
10849 _LIBCPP_INLINE_VISIBILITY
10850 bool is_lock_free() const
10851 {return atomic_is_lock_free(this);}
10852 _LIBCPP_INLINE_VISIBILITY
10853 void store(wchar_t __v, memory_order __o = memory_order_seq_cst) volatile
10854 {atomic_store_explicit(this, __v, __o);}
10855 _LIBCPP_INLINE_VISIBILITY
10856 void store(wchar_t __v, memory_order __o = memory_order_seq_cst)
10857 {atomic_store_explicit(this, __v, __o);}
10858 _LIBCPP_INLINE_VISIBILITY
10859 wchar_t load(memory_order __o = memory_order_seq_cst) const volatile
10860 {return atomic_load_explicit(this, __o);}
10861 _LIBCPP_INLINE_VISIBILITY
10862 wchar_t load(memory_order __o = memory_order_seq_cst) const
10863 {return atomic_load_explicit(this, __o);}
10864 _LIBCPP_INLINE_VISIBILITY
10865 operator wchar_t() const volatile
10866 {return load();}
10867 _LIBCPP_INLINE_VISIBILITY
10868 operator wchar_t() const
10869 {return load();}
10870 _LIBCPP_INLINE_VISIBILITY
10871 wchar_t exchange(wchar_t __v,
10872 memory_order __o = memory_order_seq_cst) volatile
10873 {return atomic_exchange_explicit(this, __v, __o);}
10874 _LIBCPP_INLINE_VISIBILITY
10875 wchar_t exchange(wchar_t __v, memory_order __o = memory_order_seq_cst)
10876 {return atomic_exchange_explicit(this, __v, __o);}
10877 _LIBCPP_INLINE_VISIBILITY
10878 bool compare_exchange_weak(wchar_t& __v, wchar_t __e, memory_order __s,
10879 memory_order __f) volatile
10880 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
10881 __f);}
10882 _LIBCPP_INLINE_VISIBILITY
10883 bool compare_exchange_weak(wchar_t& __v, wchar_t __e, memory_order __s,
10884 memory_order __f)
10885 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
10886 __f);}
10887 _LIBCPP_INLINE_VISIBILITY
10888 bool compare_exchange_strong(wchar_t& __v, wchar_t __e, memory_order __s,
10889 memory_order __f) volatile
10890 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
10891 __f);}
10892 _LIBCPP_INLINE_VISIBILITY
10893 bool compare_exchange_strong(wchar_t& __v, wchar_t __e, memory_order __s,
10894 memory_order __f)
10895 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
10896 __f);}
10897 _LIBCPP_INLINE_VISIBILITY
10898 bool compare_exchange_weak(wchar_t& __v, wchar_t __e,
10899 memory_order __s = memory_order_seq_cst) volatile
10900 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
10901 __translate_memory_order(__s));}
10902 _LIBCPP_INLINE_VISIBILITY
10903 bool compare_exchange_weak(wchar_t& __v, wchar_t __e,
10904 memory_order __s = memory_order_seq_cst)
10905 {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s,
10906 __translate_memory_order(__s));}
10907 _LIBCPP_INLINE_VISIBILITY
10908 bool compare_exchange_strong(wchar_t& __v, wchar_t __e,
10909 memory_order __s = memory_order_seq_cst) volatile
10910 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
10911 __translate_memory_order(__s));}
10912 _LIBCPP_INLINE_VISIBILITY
10913 bool compare_exchange_strong(wchar_t& __v, wchar_t __e,
10914 memory_order __s = memory_order_seq_cst)
10915 {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s,
10916 __translate_memory_order(__s));}
10917 _LIBCPP_INLINE_VISIBILITY
10918 wchar_t fetch_add(wchar_t __v,
10919 memory_order __o = memory_order_seq_cst) volatile
10920 {return atomic_fetch_add_explicit(this, __v, __o);}
10921 _LIBCPP_INLINE_VISIBILITY
10922 wchar_t fetch_add(wchar_t __v, memory_order __o = memory_order_seq_cst)
10923 {return atomic_fetch_add_explicit(this, __v, __o);}
10924 _LIBCPP_INLINE_VISIBILITY
10925 wchar_t fetch_sub(wchar_t __v,
10926 memory_order __o = memory_order_seq_cst) volatile
10927 {return atomic_fetch_sub_explicit(this, __v, __o);}
10928 _LIBCPP_INLINE_VISIBILITY
10929 wchar_t fetch_sub(wchar_t __v, memory_order __o = memory_order_seq_cst)
10930 {return atomic_fetch_sub_explicit(this, __v, __o);}
10931 _LIBCPP_INLINE_VISIBILITY
10932 wchar_t fetch_and(wchar_t __v,
10933 memory_order __o = memory_order_seq_cst) volatile
10934 {return atomic_fetch_and_explicit(this, __v, __o);}
10935 _LIBCPP_INLINE_VISIBILITY
10936 wchar_t fetch_and(wchar_t __v, memory_order __o = memory_order_seq_cst)
10937 {return atomic_fetch_and_explicit(this, __v, __o);}
10938 _LIBCPP_INLINE_VISIBILITY
10939 wchar_t fetch_or(wchar_t __v,
10940 memory_order __o = memory_order_seq_cst) volatile
10941 {return atomic_fetch_or_explicit(this, __v, __o);}
10942 _LIBCPP_INLINE_VISIBILITY
10943 wchar_t fetch_or(wchar_t __v, memory_order __o = memory_order_seq_cst)
10944 {return atomic_fetch_or_explicit(this, __v, __o);}
10945 _LIBCPP_INLINE_VISIBILITY
10946 wchar_t fetch_xor(wchar_t __v,
10947 memory_order __o = memory_order_seq_cst) volatile
10948 {return atomic_fetch_xor_explicit(this, __v, __o);}
10949 _LIBCPP_INLINE_VISIBILITY
10950 wchar_t fetch_xor(wchar_t __v, memory_order __o = memory_order_seq_cst)
10951 {return atomic_fetch_xor_explicit(this, __v, __o);}
10952#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
10953 atomic_wchar_t() = default;
10954#else
10955 _LIBCPP_INLINE_VISIBILITY
10956 atomic_wchar_t() {}
10957#endif
10958 _LIBCPP_INLINE_VISIBILITY
10959 /*constexpr*/ atomic_wchar_t(wchar_t __v)
10960 : __v_(__v) {}
10961#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
10962 atomic_wchar_t(const atomic_wchar_t&) = delete;
10963 atomic_wchar_t& operator=(const atomic_wchar_t&) = delete;
10964 atomic_wchar_t& operator=(const atomic_wchar_t&) volatile = delete;
10965#else
10966private:
10967 atomic_wchar_t(const atomic_wchar_t&);
10968 atomic_wchar_t& operator=(const atomic_wchar_t&);
10969 atomic_wchar_t& operator=(const atomic_wchar_t&) volatile;
10970public:
10971#endif
10972 _LIBCPP_INLINE_VISIBILITY
10973 wchar_t operator=(wchar_t __v) volatile
10974 {store(__v); return __v;}
10975 _LIBCPP_INLINE_VISIBILITY
10976 wchar_t operator=(wchar_t __v)
10977 {store(__v); return __v;}
10978 _LIBCPP_INLINE_VISIBILITY
10979 wchar_t operator++(int) volatile
10980 {return fetch_add(wchar_t(1));}
10981 _LIBCPP_INLINE_VISIBILITY
10982 wchar_t operator++(int)
10983 {return fetch_add(wchar_t(1));}
10984 _LIBCPP_INLINE_VISIBILITY
10985 wchar_t operator--(int) volatile
10986 {return fetch_sub(wchar_t(1));}
10987 _LIBCPP_INLINE_VISIBILITY
10988 wchar_t operator--(int)
10989 {return fetch_sub(wchar_t(1));}
10990 _LIBCPP_INLINE_VISIBILITY
10991 wchar_t operator++() volatile
10992 {return wchar_t(fetch_add(wchar_t(1)) + 1);}
10993 _LIBCPP_INLINE_VISIBILITY
10994 wchar_t operator++()
10995 {return wchar_t(fetch_add(wchar_t(1)) + 1);}
10996 _LIBCPP_INLINE_VISIBILITY
10997 wchar_t operator--() volatile
10998 {return wchar_t(fetch_sub(wchar_t(1)) - 1);}
10999 _LIBCPP_INLINE_VISIBILITY
11000 wchar_t operator--()
11001 {return wchar_t(fetch_sub(wchar_t(1)) - 1);}
11002 _LIBCPP_INLINE_VISIBILITY
11003 wchar_t operator+=(wchar_t __v) volatile
11004 {return wchar_t(fetch_add(__v) + __v);}
11005 _LIBCPP_INLINE_VISIBILITY
11006 wchar_t operator+=(wchar_t __v)
11007 {return wchar_t(fetch_add(__v) + __v);}
11008 _LIBCPP_INLINE_VISIBILITY
11009 wchar_t operator-=(wchar_t __v) volatile
11010 {return wchar_t(fetch_sub(__v) - __v);}
11011 _LIBCPP_INLINE_VISIBILITY
11012 wchar_t operator-=(wchar_t __v)
11013 {return wchar_t(fetch_sub(__v) - __v);}
11014 _LIBCPP_INLINE_VISIBILITY
11015 wchar_t operator&=(wchar_t __v) volatile
11016 {return wchar_t(fetch_and(__v) & __v);}
11017 _LIBCPP_INLINE_VISIBILITY
11018 wchar_t operator&=(wchar_t __v)
11019 {return wchar_t(fetch_and(__v) & __v);}
11020 _LIBCPP_INLINE_VISIBILITY
11021 wchar_t operator|=(wchar_t __v) volatile
11022 {return wchar_t(fetch_or(__v) | __v);}
11023 _LIBCPP_INLINE_VISIBILITY
11024 wchar_t operator|=(wchar_t __v)
11025 {return wchar_t(fetch_or(__v) | __v);}
11026 _LIBCPP_INLINE_VISIBILITY
11027 wchar_t operator^=(wchar_t __v) volatile
11028 {return wchar_t(fetch_xor(__v) ^ __v);}
11029 _LIBCPP_INLINE_VISIBILITY
11030 wchar_t operator^=(wchar_t __v)
11031 {return wchar_t(fetch_xor(__v) ^ __v);}
11032} atomic_wchar_t;
11033
11034inline _LIBCPP_INLINE_VISIBILITY
11035bool
11036atomic_is_lock_free(const volatile atomic_wchar_t*)
11037{
11038 typedef wchar_t type;
11039 return __atomic_is_lock_free(type);
11040}
11041
11042inline _LIBCPP_INLINE_VISIBILITY
11043bool
11044atomic_is_lock_free(const atomic_wchar_t* __obj)
11045{
11046 return atomic_is_lock_free(const_cast<volatile atomic_wchar_t*>(__obj));
11047}
11048
11049inline _LIBCPP_INLINE_VISIBILITY
11050void
11051atomic_init(volatile atomic_wchar_t* __obj, wchar_t __desr)
11052{
11053 __obj->__v_ = __desr;
11054}
11055
11056inline _LIBCPP_INLINE_VISIBILITY
11057void
11058atomic_init(atomic_wchar_t* __obj, wchar_t __desr)
11059{
11060 __obj->__v_ = __desr;
11061}
11062
11063inline _LIBCPP_INLINE_VISIBILITY
11064void
11065atomic_store(volatile atomic_wchar_t* __obj, wchar_t __desr)
11066{
11067 __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst);
11068}
11069
11070inline _LIBCPP_INLINE_VISIBILITY
11071void
11072atomic_store(atomic_wchar_t* __obj, wchar_t __desr)
11073{
11074 atomic_store(const_cast<volatile atomic_wchar_t*>(__obj), __desr);
11075}
11076
11077inline _LIBCPP_INLINE_VISIBILITY
11078void
11079atomic_store_explicit(volatile atomic_wchar_t* __obj, wchar_t __desr,
11080 memory_order __o)
11081{
11082 __atomic_store(&__obj->__v_, __desr, __o);
11083}
11084
11085inline _LIBCPP_INLINE_VISIBILITY
11086void
11087atomic_store_explicit(atomic_wchar_t* __obj, wchar_t __desr, memory_order __o)
11088{
11089 atomic_store_explicit(const_cast<volatile atomic_wchar_t*>(__obj), __desr,
11090 __o);
11091}
11092
11093inline _LIBCPP_INLINE_VISIBILITY
11094wchar_t
11095atomic_load(const volatile atomic_wchar_t* __obj)
11096{
11097 return __atomic_load(&__obj->__v_, memory_order_seq_cst);
11098}
11099
11100inline _LIBCPP_INLINE_VISIBILITY
11101wchar_t
11102atomic_load(const atomic_wchar_t* __obj)
11103{
11104 return atomic_load(const_cast<const volatile atomic_wchar_t*>(__obj));
11105}
11106
11107inline _LIBCPP_INLINE_VISIBILITY
11108wchar_t
11109atomic_load_explicit(const volatile atomic_wchar_t* __obj, memory_order __o)
11110{
11111 return __atomic_load(&__obj->__v_, __o);
11112}
11113
11114inline _LIBCPP_INLINE_VISIBILITY
11115wchar_t
11116atomic_load_explicit(const atomic_wchar_t* __obj, memory_order __o)
11117{
11118 return atomic_load_explicit(const_cast<const volatile atomic_wchar_t*>
11119 (__obj), __o);
11120}
11121
11122inline _LIBCPP_INLINE_VISIBILITY
11123wchar_t
11124atomic_exchange(volatile atomic_wchar_t* __obj, wchar_t __desr)
11125{
11126 return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst);
11127}
11128
11129inline _LIBCPP_INLINE_VISIBILITY
11130wchar_t
11131atomic_exchange(atomic_wchar_t* __obj, wchar_t __desr)
11132{
11133 return atomic_exchange(const_cast<volatile atomic_wchar_t*>(__obj), __desr);
11134}
11135
11136inline _LIBCPP_INLINE_VISIBILITY
11137wchar_t
11138atomic_exchange_explicit(volatile atomic_wchar_t* __obj, wchar_t __desr,
11139 memory_order __o)
11140{
11141 return __atomic_exchange(&__obj->__v_, __desr, __o);
11142}
11143
11144inline _LIBCPP_INLINE_VISIBILITY
11145wchar_t
11146atomic_exchange_explicit(atomic_wchar_t* __obj, wchar_t __desr,
11147 memory_order __o)
11148{
11149 return atomic_exchange_explicit(const_cast<volatile atomic_wchar_t*>
11150 (__obj), __desr, __o);
11151}
11152
11153inline _LIBCPP_INLINE_VISIBILITY
11154bool
11155atomic_compare_exchange_weak(volatile atomic_wchar_t* __obj, wchar_t* __exp,
11156 wchar_t __desr)
11157{
11158 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr,
11159 memory_order_seq_cst, memory_order_seq_cst);
11160}
11161
11162inline _LIBCPP_INLINE_VISIBILITY
11163bool
11164atomic_compare_exchange_weak(atomic_wchar_t* __obj, wchar_t* __exp,
11165 wchar_t __desr)
11166{
11167 return atomic_compare_exchange_weak(const_cast<volatile atomic_wchar_t*>
11168 (__obj), __exp, __desr);
11169}
11170
11171inline _LIBCPP_INLINE_VISIBILITY
11172bool
11173atomic_compare_exchange_strong(volatile atomic_wchar_t* __obj, wchar_t* __exp,
11174 wchar_t __desr)
11175{
11176 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr,
11177 memory_order_seq_cst, memory_order_seq_cst);
11178}
11179
11180inline _LIBCPP_INLINE_VISIBILITY
11181bool
11182atomic_compare_exchange_strong(atomic_wchar_t* __obj, wchar_t* __exp,
11183 wchar_t __desr)
11184{
11185 return atomic_compare_exchange_strong(const_cast<volatile atomic_wchar_t*>
11186 (__obj), __exp, __desr);
11187}
11188
11189inline _LIBCPP_INLINE_VISIBILITY
11190bool
11191atomic_compare_exchange_weak_explicit(volatile atomic_wchar_t* __obj,
11192 wchar_t* __exp, wchar_t __desr,
11193 memory_order __s, memory_order __f)
11194{
11195 return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s,
11196 __f);
11197}
11198
11199inline _LIBCPP_INLINE_VISIBILITY
11200bool
11201atomic_compare_exchange_weak_explicit(atomic_wchar_t* __obj, wchar_t* __exp,
11202 wchar_t __desr, memory_order __s,
11203 memory_order __f)
11204{
11205 return atomic_compare_exchange_weak_explicit(
11206 const_cast<volatile atomic_wchar_t*>(__obj), __exp, __desr, __s, __f);
11207}
11208
11209inline _LIBCPP_INLINE_VISIBILITY
11210bool
11211atomic_compare_exchange_strong_explicit(volatile atomic_wchar_t* __obj,
11212 wchar_t* __exp, wchar_t __desr,
11213 memory_order __s, memory_order __f)
11214{
11215 return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s,
11216 __f);
11217}
11218
11219inline _LIBCPP_INLINE_VISIBILITY
11220bool
11221atomic_compare_exchange_strong_explicit(atomic_wchar_t* __obj, wchar_t* __exp,
11222 wchar_t __desr, memory_order __s,
11223 memory_order __f)
11224{
11225 return atomic_compare_exchange_strong_explicit(
11226 const_cast<volatile atomic_wchar_t*>(__obj), __exp, __desr, __s, __f);
11227}
11228
11229inline _LIBCPP_INLINE_VISIBILITY
11230wchar_t
11231atomic_fetch_add(volatile atomic_wchar_t* __obj, wchar_t __v)
11232{
11233 return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst);
11234}
11235
11236inline _LIBCPP_INLINE_VISIBILITY
11237wchar_t
11238atomic_fetch_add(atomic_wchar_t* __obj, wchar_t __v)
11239{
11240 return atomic_fetch_add(const_cast<volatile atomic_wchar_t*>(__obj), __v);
11241}
11242
11243inline _LIBCPP_INLINE_VISIBILITY
11244wchar_t
11245atomic_fetch_add_explicit(volatile atomic_wchar_t* __obj, wchar_t __v,
11246 memory_order __o)
11247{
11248 return __atomic_fetch_add(&__obj->__v_, __v, __o);
11249}
11250
11251inline _LIBCPP_INLINE_VISIBILITY
11252wchar_t
11253atomic_fetch_add_explicit(atomic_wchar_t* __obj, wchar_t __v,
11254 memory_order __o)
11255{
11256 return atomic_fetch_add_explicit(const_cast<volatile atomic_wchar_t*>(__obj),
11257 __v, __o);
11258}
11259
11260inline _LIBCPP_INLINE_VISIBILITY
11261wchar_t
11262atomic_fetch_sub(volatile atomic_wchar_t* __obj, wchar_t __v)
11263{
11264 return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst);
11265}
11266
11267inline _LIBCPP_INLINE_VISIBILITY
11268wchar_t
11269atomic_fetch_sub(atomic_wchar_t* __obj, wchar_t __v)
11270{
11271 return atomic_fetch_sub(const_cast<volatile atomic_wchar_t*>(__obj), __v);
11272}
11273
11274inline _LIBCPP_INLINE_VISIBILITY
11275wchar_t
11276atomic_fetch_sub_explicit(volatile atomic_wchar_t* __obj, wchar_t __v,
11277 memory_order __o)
11278{
11279 return __atomic_fetch_sub(&__obj->__v_, __v, __o);
11280}
11281
11282inline _LIBCPP_INLINE_VISIBILITY
11283wchar_t
11284atomic_fetch_sub_explicit(atomic_wchar_t* __obj, wchar_t __v,
11285 memory_order __o)
11286{
11287 return atomic_fetch_sub_explicit(const_cast<volatile atomic_wchar_t*>(__obj),
11288 __v, __o);
11289}
11290
11291inline _LIBCPP_INLINE_VISIBILITY
11292wchar_t
11293atomic_fetch_and(volatile atomic_wchar_t* __obj, wchar_t __v)
11294{
11295 return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst);
11296}
11297
11298inline _LIBCPP_INLINE_VISIBILITY
11299wchar_t
11300atomic_fetch_and(atomic_wchar_t* __obj, wchar_t __v)
11301{
11302 return atomic_fetch_and(const_cast<volatile atomic_wchar_t*>(__obj), __v);
11303}
11304
11305inline _LIBCPP_INLINE_VISIBILITY
11306wchar_t
11307atomic_fetch_and_explicit(volatile atomic_wchar_t* __obj, wchar_t __v,
11308 memory_order __o)
11309{
11310 return __atomic_fetch_and(&__obj->__v_, __v, __o);
11311}
11312
11313inline _LIBCPP_INLINE_VISIBILITY
11314wchar_t
11315atomic_fetch_and_explicit(atomic_wchar_t* __obj, wchar_t __v,
11316 memory_order __o)
11317{
11318 return atomic_fetch_and_explicit(const_cast<volatile atomic_wchar_t*>(__obj),
11319 __v, __o);
11320}
11321
11322inline _LIBCPP_INLINE_VISIBILITY
11323wchar_t
11324atomic_fetch_or(volatile atomic_wchar_t* __obj, wchar_t __v)
11325{
11326 return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst);
11327}
11328
11329inline _LIBCPP_INLINE_VISIBILITY
11330wchar_t
11331atomic_fetch_or(atomic_wchar_t* __obj, wchar_t __v)
11332{
11333 return atomic_fetch_or(const_cast<volatile atomic_wchar_t*>(__obj), __v);
11334}
11335
11336inline _LIBCPP_INLINE_VISIBILITY
11337wchar_t
11338atomic_fetch_or_explicit(volatile atomic_wchar_t* __obj, wchar_t __v,
11339 memory_order __o)
11340{
11341 return __atomic_fetch_or(&__obj->__v_, __v, __o);
11342}
11343
11344inline _LIBCPP_INLINE_VISIBILITY
11345wchar_t
11346atomic_fetch_or_explicit(atomic_wchar_t* __obj, wchar_t __v, memory_order __o)
11347{
11348 return atomic_fetch_or_explicit(const_cast<volatile atomic_wchar_t*>(__obj),
11349 __v, __o);
11350}
11351
11352inline _LIBCPP_INLINE_VISIBILITY
11353wchar_t
11354atomic_fetch_xor(volatile atomic_wchar_t* __obj, wchar_t __v)
11355{
11356 return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst);
11357}
11358
11359inline _LIBCPP_INLINE_VISIBILITY
11360wchar_t
11361atomic_fetch_xor(atomic_wchar_t* __obj, wchar_t __v)
11362{
11363 return atomic_fetch_xor(const_cast<volatile atomic_wchar_t*>(__obj), __v);
11364}
11365
11366inline _LIBCPP_INLINE_VISIBILITY
11367wchar_t
11368atomic_fetch_xor_explicit(volatile atomic_wchar_t* __obj, wchar_t __v,
11369 memory_order __o)
11370{
11371 return __atomic_fetch_xor(&__obj->__v_, __v, __o);
11372}
11373
11374inline _LIBCPP_INLINE_VISIBILITY
11375wchar_t
11376atomic_fetch_xor_explicit(atomic_wchar_t* __obj, wchar_t __v,
11377 memory_order __o)
11378{
11379 return atomic_fetch_xor_explicit(const_cast<volatile atomic_wchar_t*>(__obj),
11380 __v, __o);
11381}
11382
Howard Hinnant8f73c632010-09-27 21:17:38 +000011383_LIBCPP_END_NAMESPACE_STD
11384
11385#endif // _LIBCPP_ATOMIC