1b9ce6be97f9efdb23debaaa87c820406a65ccf2
[model-checker.git] / include / impatomic.h
1 /**
2  * @file impatomic.h
3  * @brief Common header for C11/C++11 atomics
4  *
5  * Note that some features are unavailable, as they require support from a true
6  * C11/C++11 compiler.
7  */
8
9 #ifndef __IMPATOMIC_H__
10 #define __IMPATOMIC_H__
11
12 #include "memoryorder.h"
13 #include "cmodelint.h"
14
15 #ifdef __cplusplus
16 namespace std {
17 #else
18 #include <stdbool.h>
19 #endif
20
21 #define CPP0X( feature )
22
23 typedef struct atomic_flag
24 {
25 #ifdef __cplusplus
26     bool test_and_set( memory_order = memory_order_seq_cst ) volatile;
27     void clear( memory_order = memory_order_seq_cst ) volatile;
28
29     CPP0X( atomic_flag() = default; )
30     CPP0X( atomic_flag( const atomic_flag& ) = delete; )
31     atomic_flag& operator =( const atomic_flag& ) CPP0X(=delete);
32
33 CPP0X(private:)
34 #endif
35     bool __f__;
36 } atomic_flag;
37
38 #define ATOMIC_FLAG_INIT { false }
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 extern bool atomic_flag_test_and_set( volatile atomic_flag* );
45 extern bool atomic_flag_test_and_set_explicit
46 ( volatile atomic_flag*, memory_order );
47 extern void atomic_flag_clear( volatile atomic_flag* );
48 extern void atomic_flag_clear_explicit
49 ( volatile atomic_flag*, memory_order );
50 extern void __atomic_flag_wait__
51 ( volatile atomic_flag* );
52 extern void __atomic_flag_wait_explicit__
53 ( volatile atomic_flag*, memory_order );
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #ifdef __cplusplus
60
61 inline bool atomic_flag::test_and_set( memory_order __x__ ) volatile
62 { return atomic_flag_test_and_set_explicit( this, __x__ ); }
63
64 inline void atomic_flag::clear( memory_order __x__ ) volatile
65 { atomic_flag_clear_explicit( this, __x__ ); }
66
67 #endif
68
69
70 /*
71         The remainder of the example implementation uses the following
72         macros. These macros exploit GNU extensions for value-returning
73         blocks (AKA statement expressions) and __typeof__.
74
75         The macros rely on data fields of atomic structs being named __f__.
76         Other symbols used are __a__=atomic, __e__=expected, __f__=field,
77         __g__=flag, __m__=modified, __o__=operation, __r__=result,
78         __p__=pointer to field, __v__=value (for single evaluation),
79         __x__=memory-ordering, and __y__=memory-ordering.
80 */
81
82 #define _ATOMIC_LOAD_( __a__, __x__ )                                         \
83         ({ volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__);   \
84                 __typeof__((__a__)->__f__) __r__ = (__typeof__((__a__)->__f__))model_read_action((void *)__p__, __x__);  \
85                 __r__; })
86
87 #define _ATOMIC_STORE_( __a__, __m__, __x__ )                                 \
88         ({ volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__);   \
89                 __typeof__(__m__) __v__ = (__m__);                            \
90                 model_write_action((void *) __p__,  __x__, (uint64_t) __v__); \
91                 __v__ = __v__; /* Silence clang (-Wunused-value) */           \
92          })
93
94
95 #define _ATOMIC_INIT_( __a__, __m__ )                                         \
96         ({ volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__);   \
97                 __typeof__(__m__) __v__ = (__m__);                            \
98                 model_init_action((void *) __p__,  (uint64_t) __v__);         \
99                 __v__ = __v__; /* Silence clang (-Wunused-value) */           \
100          })
101
102 #define _ATOMIC_MODIFY_( __a__, __o__, __m__, __x__ )                         \
103         ({ volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__);   \
104         __typeof__((__a__)->__f__) __old__=(__typeof__((__a__)->__f__)) model_rmwr_action((void *)__p__, __x__); \
105         __typeof__(__m__) __v__ = (__m__);                                    \
106         __typeof__((__a__)->__f__) __copy__= __old__;                         \
107         __copy__ __o__ __v__;                                                 \
108         model_rmw_action((void *)__p__, __x__, (uint64_t) __copy__);          \
109         __old__ = __old__; /* Silence clang (-Wunused-value) */               \
110          })
111
112 /* No spurious failure for now */
113 #define _ATOMIC_CMPSWP_WEAK_ _ATOMIC_CMPSWP_
114
115 #define _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ )                         \
116         ({ volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__);   \
117                 __typeof__(__e__) __q__ = (__e__);                            \
118                 __typeof__(__m__) __v__ = (__m__);                            \
119                 bool __r__;                                                   \
120                 __typeof__((__a__)->__f__) __t__=(__typeof__((__a__)->__f__)) model_rmwr_action((void *)__p__, __x__); \
121                 if (__t__ == * __q__ ) {                                      \
122                         model_rmw_action((void *)__p__, __x__, (uint64_t) __v__); __r__ = true; } \
123                 else {  model_rmwc_action((void *)__p__, __x__); *__q__ = __t__;  __r__ = false;} \
124                 __r__; })
125
126 #define _ATOMIC_FENCE_( __x__ ) \
127         ({ model_fence_action(__x__);})
128  
129
130 #define ATOMIC_CHAR_LOCK_FREE 1
131 #define ATOMIC_CHAR16_T_LOCK_FREE 1
132 #define ATOMIC_CHAR32_T_LOCK_FREE 1
133 #define ATOMIC_WCHAR_T_LOCK_FREE 1
134 #define ATOMIC_SHORT_LOCK_FREE 1
135 #define ATOMIC_INT_LOCK_FREE 1
136 #define ATOMIC_LONG_LOCK_FREE 1
137 #define ATOMIC_LLONG_LOCK_FREE 1
138 #define ATOMIC_ADDRESS_LOCK_FREE 1
139
140 typedef struct atomic_bool
141 {
142 #ifdef __cplusplus
143     bool is_lock_free() const volatile;
144     void store( bool, memory_order = memory_order_seq_cst ) volatile;
145     bool load( memory_order = memory_order_seq_cst ) volatile;
146     bool exchange( bool, memory_order = memory_order_seq_cst ) volatile;
147     bool compare_exchange_weak ( bool&, bool, memory_order, memory_order ) volatile;
148     bool compare_exchange_strong ( bool&, bool, memory_order, memory_order ) volatile;
149     bool compare_exchange_weak ( bool&, bool,
150                         memory_order = memory_order_seq_cst) volatile;
151     bool compare_exchange_strong ( bool&, bool,
152                         memory_order = memory_order_seq_cst) volatile;
153
154     CPP0X( atomic_bool() = delete; )
155     CPP0X( constexpr explicit atomic_bool( bool __v__ ) : __f__( __v__ ) { } )
156     CPP0X( atomic_bool( const atomic_bool& ) = delete; )
157     atomic_bool& operator =( const atomic_bool& ) CPP0X(=delete);
158
159     bool operator =( bool __v__ ) volatile
160     { store( __v__ ); return __v__; }
161
162     friend void atomic_store_explicit( volatile atomic_bool*, bool,
163                                        memory_order );
164     friend bool atomic_load_explicit( volatile atomic_bool*, memory_order );
165     friend bool atomic_exchange_explicit( volatile atomic_bool*, bool,
166                                       memory_order );
167     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_bool*, bool*, bool,
168                                               memory_order, memory_order );
169     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_bool*, bool*, bool,
170                                               memory_order, memory_order );
171
172 CPP0X(private:)
173 #endif
174     bool __f__;
175 } atomic_bool;
176
177
178 typedef struct atomic_address
179 {
180 #ifdef __cplusplus
181     bool is_lock_free() const volatile;
182     void store( void*, memory_order = memory_order_seq_cst ) volatile;
183     void* load( memory_order = memory_order_seq_cst ) volatile;
184     void* exchange( void*, memory_order = memory_order_seq_cst ) volatile;
185     bool compare_exchange_weak( void*&, void*, memory_order, memory_order ) volatile;
186     bool compare_exchange_strong( void*&, void*, memory_order, memory_order ) volatile;
187     bool compare_exchange_weak( void*&, void*,
188                        memory_order = memory_order_seq_cst ) volatile;
189     bool compare_exchange_strong( void*&, void*,
190                        memory_order = memory_order_seq_cst ) volatile;
191     void* fetch_add( ptrdiff_t, memory_order = memory_order_seq_cst ) volatile;
192     void* fetch_sub( ptrdiff_t, memory_order = memory_order_seq_cst ) volatile;
193
194     CPP0X( atomic_address() = default; )
195     CPP0X( constexpr explicit atomic_address( void* __v__ ) : __f__( __v__) { } )
196     CPP0X( atomic_address( const atomic_address& ) = delete; )
197     atomic_address& operator =( const atomic_address & ) CPP0X(=delete);
198
199     void* operator =( void* __v__ ) volatile
200     { store( __v__ ); return __v__; }
201
202     void* operator +=( ptrdiff_t __v__ ) volatile
203     { return fetch_add( __v__ ); }
204
205     void* operator -=( ptrdiff_t __v__ ) volatile
206     { return fetch_sub( __v__ ); }
207
208     friend void atomic_store_explicit( volatile atomic_address*, void*,
209                                        memory_order );
210     friend void* atomic_load_explicit( volatile atomic_address*, memory_order );
211     friend void* atomic_exchange_explicit( volatile atomic_address*, void*,
212                                        memory_order );
213     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_address*,
214                               void**, void*, memory_order, memory_order );
215     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_address*,
216                               void**, void*, memory_order, memory_order );
217     friend void* atomic_fetch_add_explicit( volatile atomic_address*, ptrdiff_t,
218                                             memory_order );
219     friend void* atomic_fetch_sub_explicit( volatile atomic_address*, ptrdiff_t,
220                                             memory_order );
221
222 CPP0X(private:)
223 #endif
224     void* __f__;
225 } atomic_address;
226
227
228 typedef struct atomic_char
229 {
230 #ifdef __cplusplus
231     bool is_lock_free() const volatile;
232     void store( char,
233                 memory_order = memory_order_seq_cst ) volatile;
234     char load( memory_order = memory_order_seq_cst ) volatile;
235     char exchange( char,
236                       memory_order = memory_order_seq_cst ) volatile;
237     bool compare_exchange_weak( char&, char,
238                        memory_order, memory_order ) volatile;
239     bool compare_exchange_strong( char&, char,
240                        memory_order, memory_order ) volatile;
241     bool compare_exchange_weak( char&, char,
242                        memory_order = memory_order_seq_cst ) volatile;
243     bool compare_exchange_strong( char&, char,
244                        memory_order = memory_order_seq_cst ) volatile;
245     char fetch_add( char,
246                            memory_order = memory_order_seq_cst ) volatile;
247     char fetch_sub( char,
248                            memory_order = memory_order_seq_cst ) volatile;
249     char fetch_and( char,
250                            memory_order = memory_order_seq_cst ) volatile;
251     char fetch_or( char,
252                            memory_order = memory_order_seq_cst ) volatile;
253     char fetch_xor( char,
254                            memory_order = memory_order_seq_cst ) volatile;
255
256     CPP0X( atomic_char() = default; )
257     CPP0X( constexpr atomic_char( char __v__ ) : __f__( __v__) { } )
258     CPP0X( atomic_char( const atomic_char& ) = delete; )
259     atomic_char& operator =( const atomic_char& ) CPP0X(=delete);
260
261     char operator =( char __v__ ) volatile
262     { store( __v__ ); return __v__; }
263
264     char operator ++( int ) volatile
265     { return fetch_add( 1 ); }
266
267     char operator --( int ) volatile
268     { return fetch_sub( 1 ); }
269
270     char operator ++() volatile
271     { return fetch_add( 1 ) + 1; }
272
273     char operator --() volatile
274     { return fetch_sub( 1 ) - 1; }
275
276     char operator +=( char __v__ ) volatile
277     { return fetch_add( __v__ ) + __v__; }
278
279     char operator -=( char __v__ ) volatile
280     { return fetch_sub( __v__ ) - __v__; }
281
282     char operator &=( char __v__ ) volatile
283     { return fetch_and( __v__ ) & __v__; }
284
285     char operator |=( char __v__ ) volatile
286     { return fetch_or( __v__ ) | __v__; }
287
288     char operator ^=( char __v__ ) volatile
289     { return fetch_xor( __v__ ) ^ __v__; }
290
291     friend void atomic_store_explicit( volatile atomic_char*, char,
292                                        memory_order );
293     friend char atomic_load_explicit( volatile atomic_char*,
294                                              memory_order );
295     friend char atomic_exchange_explicit( volatile atomic_char*,
296                                              char, memory_order );
297     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_char*,
298                       char*, char, memory_order, memory_order );
299     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_char*,
300                       char*, char, memory_order, memory_order );
301     friend char atomic_fetch_add_explicit( volatile atomic_char*,
302                                                   char, memory_order );
303     friend char atomic_fetch_sub_explicit( volatile atomic_char*,
304                                                   char, memory_order );
305     friend char atomic_fetch_and_explicit( volatile atomic_char*,
306                                                   char, memory_order );
307     friend char atomic_fetch_or_explicit(  volatile atomic_char*,
308                                                   char, memory_order );
309     friend char atomic_fetch_xor_explicit( volatile atomic_char*,
310                                                   char, memory_order );
311
312 CPP0X(private:)
313 #endif
314     char __f__;
315 } atomic_char;
316
317
318 typedef struct atomic_schar
319 {
320 #ifdef __cplusplus
321     bool is_lock_free() const volatile;
322     void store( signed char,
323                 memory_order = memory_order_seq_cst ) volatile;
324     signed char load( memory_order = memory_order_seq_cst ) volatile;
325     signed char exchange( signed char,
326                       memory_order = memory_order_seq_cst ) volatile;
327     bool compare_exchange_weak( signed char&, signed char,
328                        memory_order, memory_order ) volatile;
329     bool compare_exchange_strong( signed char&, signed char,
330                        memory_order, memory_order ) volatile;
331     bool compare_exchange_weak( signed char&, signed char,
332                        memory_order = memory_order_seq_cst ) volatile;
333     bool compare_exchange_strong( signed char&, signed char,
334                        memory_order = memory_order_seq_cst ) volatile;
335     signed char fetch_add( signed char,
336                            memory_order = memory_order_seq_cst ) volatile;
337     signed char fetch_sub( signed char,
338                            memory_order = memory_order_seq_cst ) volatile;
339     signed char fetch_and( signed char,
340                            memory_order = memory_order_seq_cst ) volatile;
341     signed char fetch_or( signed char,
342                            memory_order = memory_order_seq_cst ) volatile;
343     signed char fetch_xor( signed char,
344                            memory_order = memory_order_seq_cst ) volatile;
345
346     CPP0X( atomic_schar() = default; )
347     CPP0X( constexpr atomic_schar( signed char __v__ ) : __f__( __v__) { } )
348     CPP0X( atomic_schar( const atomic_schar& ) = delete; )
349     atomic_schar& operator =( const atomic_schar& ) CPP0X(=delete);
350
351     signed char operator =( signed char __v__ ) volatile
352     { store( __v__ ); return __v__; }
353
354     signed char operator ++( int ) volatile
355     { return fetch_add( 1 ); }
356
357     signed char operator --( int ) volatile
358     { return fetch_sub( 1 ); }
359
360     signed char operator ++() volatile
361     { return fetch_add( 1 ) + 1; }
362
363     signed char operator --() volatile
364     { return fetch_sub( 1 ) - 1; }
365
366     signed char operator +=( signed char __v__ ) volatile
367     { return fetch_add( __v__ ) + __v__; }
368
369     signed char operator -=( signed char __v__ ) volatile
370     { return fetch_sub( __v__ ) - __v__; }
371
372     signed char operator &=( signed char __v__ ) volatile
373     { return fetch_and( __v__ ) & __v__; }
374
375     signed char operator |=( signed char __v__ ) volatile
376     { return fetch_or( __v__ ) | __v__; }
377
378     signed char operator ^=( signed char __v__ ) volatile
379     { return fetch_xor( __v__ ) ^ __v__; }
380
381     friend void atomic_store_explicit( volatile atomic_schar*, signed char,
382                                        memory_order );
383     friend signed char atomic_load_explicit( volatile atomic_schar*,
384                                              memory_order );
385     friend signed char atomic_exchange_explicit( volatile atomic_schar*,
386                                              signed char, memory_order );
387     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_schar*,
388                       signed char*, signed char, memory_order, memory_order );
389     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_schar*,
390                       signed char*, signed char, memory_order, memory_order );
391     friend signed char atomic_fetch_add_explicit( volatile atomic_schar*,
392                                                   signed char, memory_order );
393     friend signed char atomic_fetch_sub_explicit( volatile atomic_schar*,
394                                                   signed char, memory_order );
395     friend signed char atomic_fetch_and_explicit( volatile atomic_schar*,
396                                                   signed char, memory_order );
397     friend signed char atomic_fetch_or_explicit(  volatile atomic_schar*,
398                                                   signed char, memory_order );
399     friend signed char atomic_fetch_xor_explicit( volatile atomic_schar*,
400                                                   signed char, memory_order );
401
402 CPP0X(private:)
403 #endif
404     signed char __f__;
405 } atomic_schar;
406
407
408 typedef struct atomic_uchar
409 {
410 #ifdef __cplusplus
411     bool is_lock_free() const volatile;
412     void store( unsigned char,
413                 memory_order = memory_order_seq_cst ) volatile;
414     unsigned char load( memory_order = memory_order_seq_cst ) volatile;
415     unsigned char exchange( unsigned char,
416                       memory_order = memory_order_seq_cst ) volatile;
417     bool compare_exchange_weak( unsigned char&, unsigned char,
418                        memory_order, memory_order ) volatile;
419     bool compare_exchange_strong( unsigned char&, unsigned char,
420                        memory_order, memory_order ) volatile;
421     bool compare_exchange_weak( unsigned char&, unsigned char,
422                        memory_order = memory_order_seq_cst ) volatile;
423     bool compare_exchange_strong( unsigned char&, unsigned char,
424                        memory_order = memory_order_seq_cst ) volatile;
425     unsigned char fetch_add( unsigned char,
426                            memory_order = memory_order_seq_cst ) volatile;
427     unsigned char fetch_sub( unsigned char,
428                            memory_order = memory_order_seq_cst ) volatile;
429     unsigned char fetch_and( unsigned char,
430                            memory_order = memory_order_seq_cst ) volatile;
431     unsigned char fetch_or( unsigned char,
432                            memory_order = memory_order_seq_cst ) volatile;
433     unsigned char fetch_xor( unsigned char,
434                            memory_order = memory_order_seq_cst ) volatile;
435
436     CPP0X( atomic_uchar() = default; )
437     CPP0X( constexpr atomic_uchar( unsigned char __v__ ) : __f__( __v__) { } )
438     CPP0X( atomic_uchar( const atomic_uchar& ) = delete; )
439     atomic_uchar& operator =( const atomic_uchar& ) CPP0X(=delete);
440
441     unsigned char operator =( unsigned char __v__ ) volatile
442     { store( __v__ ); return __v__; }
443
444     unsigned char operator ++( int ) volatile
445     { return fetch_add( 1 ); }
446
447     unsigned char operator --( int ) volatile
448     { return fetch_sub( 1 ); }
449
450     unsigned char operator ++() volatile
451     { return fetch_add( 1 ) + 1; }
452
453     unsigned char operator --() volatile
454     { return fetch_sub( 1 ) - 1; }
455
456     unsigned char operator +=( unsigned char __v__ ) volatile
457     { return fetch_add( __v__ ) + __v__; }
458
459     unsigned char operator -=( unsigned char __v__ ) volatile
460     { return fetch_sub( __v__ ) - __v__; }
461
462     unsigned char operator &=( unsigned char __v__ ) volatile
463     { return fetch_and( __v__ ) & __v__; }
464
465     unsigned char operator |=( unsigned char __v__ ) volatile
466     { return fetch_or( __v__ ) | __v__; }
467
468     unsigned char operator ^=( unsigned char __v__ ) volatile
469     { return fetch_xor( __v__ ) ^ __v__; }
470
471     friend void atomic_store_explicit( volatile atomic_uchar*, unsigned char,
472                                        memory_order );
473     friend unsigned char atomic_load_explicit( volatile atomic_uchar*,
474                                              memory_order );
475     friend unsigned char atomic_exchange_explicit( volatile atomic_uchar*,
476                                              unsigned char, memory_order );
477     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_uchar*,
478                       unsigned char*, unsigned char, memory_order, memory_order );
479     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_uchar*,
480                       unsigned char*, unsigned char, memory_order, memory_order );
481     friend unsigned char atomic_fetch_add_explicit( volatile atomic_uchar*,
482                                                   unsigned char, memory_order );
483     friend unsigned char atomic_fetch_sub_explicit( volatile atomic_uchar*,
484                                                   unsigned char, memory_order );
485     friend unsigned char atomic_fetch_and_explicit( volatile atomic_uchar*,
486                                                   unsigned char, memory_order );
487     friend unsigned char atomic_fetch_or_explicit(  volatile atomic_uchar*,
488                                                   unsigned char, memory_order );
489     friend unsigned char atomic_fetch_xor_explicit( volatile atomic_uchar*,
490                                                   unsigned char, memory_order );
491
492 CPP0X(private:)
493 #endif
494     unsigned char __f__;
495 } atomic_uchar;
496
497
498 typedef struct atomic_short
499 {
500 #ifdef __cplusplus
501     bool is_lock_free() const volatile;
502     void store( short,
503                 memory_order = memory_order_seq_cst ) volatile;
504     short load( memory_order = memory_order_seq_cst ) volatile;
505     short exchange( short,
506                       memory_order = memory_order_seq_cst ) volatile;
507     bool compare_exchange_weak( short&, short,
508                        memory_order, memory_order ) volatile;
509     bool compare_exchange_strong( short&, short,
510                        memory_order, memory_order ) volatile;
511     bool compare_exchange_weak( short&, short,
512                        memory_order = memory_order_seq_cst ) volatile;
513     bool compare_exchange_strong( short&, short,
514                        memory_order = memory_order_seq_cst ) volatile;
515     short fetch_add( short,
516                            memory_order = memory_order_seq_cst ) volatile;
517     short fetch_sub( short,
518                            memory_order = memory_order_seq_cst ) volatile;
519     short fetch_and( short,
520                            memory_order = memory_order_seq_cst ) volatile;
521     short fetch_or( short,
522                            memory_order = memory_order_seq_cst ) volatile;
523     short fetch_xor( short,
524                            memory_order = memory_order_seq_cst ) volatile;
525
526     CPP0X( atomic_short() = default; )
527     CPP0X( constexpr atomic_short( short __v__ ) : __f__( __v__) { } )
528     CPP0X( atomic_short( const atomic_short& ) = delete; )
529     atomic_short& operator =( const atomic_short& ) CPP0X(=delete);
530
531     short operator =( short __v__ ) volatile
532     { store( __v__ ); return __v__; }
533
534     short operator ++( int ) volatile
535     { return fetch_add( 1 ); }
536
537     short operator --( int ) volatile
538     { return fetch_sub( 1 ); }
539
540     short operator ++() volatile
541     { return fetch_add( 1 ) + 1; }
542
543     short operator --() volatile
544     { return fetch_sub( 1 ) - 1; }
545
546     short operator +=( short __v__ ) volatile
547     { return fetch_add( __v__ ) + __v__; }
548
549     short operator -=( short __v__ ) volatile
550     { return fetch_sub( __v__ ) - __v__; }
551
552     short operator &=( short __v__ ) volatile
553     { return fetch_and( __v__ ) & __v__; }
554
555     short operator |=( short __v__ ) volatile
556     { return fetch_or( __v__ ) | __v__; }
557
558     short operator ^=( short __v__ ) volatile
559     { return fetch_xor( __v__ ) ^ __v__; }
560
561     friend void atomic_store_explicit( volatile atomic_short*, short,
562                                        memory_order );
563     friend short atomic_load_explicit( volatile atomic_short*,
564                                              memory_order );
565     friend short atomic_exchange_explicit( volatile atomic_short*,
566                                              short, memory_order );
567     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_short*,
568                       short*, short, memory_order, memory_order );
569     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_short*,
570                       short*, short, memory_order, memory_order );
571     friend short atomic_fetch_add_explicit( volatile atomic_short*,
572                                                   short, memory_order );
573     friend short atomic_fetch_sub_explicit( volatile atomic_short*,
574                                                   short, memory_order );
575     friend short atomic_fetch_and_explicit( volatile atomic_short*,
576                                                   short, memory_order );
577     friend short atomic_fetch_or_explicit(  volatile atomic_short*,
578                                                   short, memory_order );
579     friend short atomic_fetch_xor_explicit( volatile atomic_short*,
580                                                   short, memory_order );
581
582 CPP0X(private:)
583 #endif
584     short __f__;
585 } atomic_short;
586
587
588 typedef struct atomic_ushort
589 {
590 #ifdef __cplusplus
591     bool is_lock_free() const volatile;
592     void store( unsigned short,
593                 memory_order = memory_order_seq_cst ) volatile;
594     unsigned short load( memory_order = memory_order_seq_cst ) volatile;
595     unsigned short exchange( unsigned short,
596                       memory_order = memory_order_seq_cst ) volatile;
597     bool compare_exchange_weak( unsigned short&, unsigned short,
598                        memory_order, memory_order ) volatile;
599     bool compare_exchange_strong( unsigned short&, unsigned short,
600                        memory_order, memory_order ) volatile;
601     bool compare_exchange_weak( unsigned short&, unsigned short,
602                        memory_order = memory_order_seq_cst ) volatile;
603     bool compare_exchange_strong( unsigned short&, unsigned short,
604                        memory_order = memory_order_seq_cst ) volatile;
605     unsigned short fetch_add( unsigned short,
606                            memory_order = memory_order_seq_cst ) volatile;
607     unsigned short fetch_sub( unsigned short,
608                            memory_order = memory_order_seq_cst ) volatile;
609     unsigned short fetch_and( unsigned short,
610                            memory_order = memory_order_seq_cst ) volatile;
611     unsigned short fetch_or( unsigned short,
612                            memory_order = memory_order_seq_cst ) volatile;
613     unsigned short fetch_xor( unsigned short,
614                            memory_order = memory_order_seq_cst ) volatile;
615
616     CPP0X( atomic_ushort() = default; )
617     CPP0X( constexpr atomic_ushort( unsigned short __v__ ) : __f__( __v__) { } )
618     CPP0X( atomic_ushort( const atomic_ushort& ) = delete; )
619     atomic_ushort& operator =( const atomic_ushort& ) CPP0X(=delete);
620
621     unsigned short operator =( unsigned short __v__ ) volatile
622     { store( __v__ ); return __v__; }
623
624     unsigned short operator ++( int ) volatile
625     { return fetch_add( 1 ); }
626
627     unsigned short operator --( int ) volatile
628     { return fetch_sub( 1 ); }
629
630     unsigned short operator ++() volatile
631     { return fetch_add( 1 ) + 1; }
632
633     unsigned short operator --() volatile
634     { return fetch_sub( 1 ) - 1; }
635
636     unsigned short operator +=( unsigned short __v__ ) volatile
637     { return fetch_add( __v__ ) + __v__; }
638
639     unsigned short operator -=( unsigned short __v__ ) volatile
640     { return fetch_sub( __v__ ) - __v__; }
641
642     unsigned short operator &=( unsigned short __v__ ) volatile
643     { return fetch_and( __v__ ) & __v__; }
644
645     unsigned short operator |=( unsigned short __v__ ) volatile
646     { return fetch_or( __v__ ) | __v__; }
647
648     unsigned short operator ^=( unsigned short __v__ ) volatile
649     { return fetch_xor( __v__ ) ^ __v__; }
650
651     friend void atomic_store_explicit( volatile atomic_ushort*, unsigned short,
652                                        memory_order );
653     friend unsigned short atomic_load_explicit( volatile atomic_ushort*,
654                                              memory_order );
655     friend unsigned short atomic_exchange_explicit( volatile atomic_ushort*,
656                                              unsigned short, memory_order );
657     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_ushort*,
658                       unsigned short*, unsigned short, memory_order, memory_order );
659     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_ushort*,
660                       unsigned short*, unsigned short, memory_order, memory_order );
661     friend unsigned short atomic_fetch_add_explicit( volatile atomic_ushort*,
662                                                   unsigned short, memory_order );
663     friend unsigned short atomic_fetch_sub_explicit( volatile atomic_ushort*,
664                                                   unsigned short, memory_order );
665     friend unsigned short atomic_fetch_and_explicit( volatile atomic_ushort*,
666                                                   unsigned short, memory_order );
667     friend unsigned short atomic_fetch_or_explicit(  volatile atomic_ushort*,
668                                                   unsigned short, memory_order );
669     friend unsigned short atomic_fetch_xor_explicit( volatile atomic_ushort*,
670                                                   unsigned short, memory_order );
671
672 CPP0X(private:)
673 #endif
674     unsigned short __f__;
675 } atomic_ushort;
676
677
678 typedef struct atomic_int
679 {
680 #ifdef __cplusplus
681     bool is_lock_free() const volatile;
682     void store( int,
683                 memory_order = memory_order_seq_cst ) volatile;
684     int load( memory_order = memory_order_seq_cst ) volatile;
685     int exchange( int,
686                       memory_order = memory_order_seq_cst ) volatile;
687     bool compare_exchange_weak( int&, int,
688                        memory_order, memory_order ) volatile;
689     bool compare_exchange_strong( int&, int,
690                        memory_order, memory_order ) volatile;
691     bool compare_exchange_weak( int&, int,
692                        memory_order = memory_order_seq_cst ) volatile;
693     bool compare_exchange_strong( int&, int,
694                        memory_order = memory_order_seq_cst ) volatile;
695     int fetch_add( int,
696                            memory_order = memory_order_seq_cst ) volatile;
697     int fetch_sub( int,
698                            memory_order = memory_order_seq_cst ) volatile;
699     int fetch_and( int,
700                            memory_order = memory_order_seq_cst ) volatile;
701     int fetch_or( int,
702                            memory_order = memory_order_seq_cst ) volatile;
703     int fetch_xor( int,
704                            memory_order = memory_order_seq_cst ) volatile;
705
706     CPP0X( atomic_int() = default; )
707     CPP0X( constexpr atomic_int( int __v__ ) : __f__( __v__) { } )
708     CPP0X( atomic_int( const atomic_int& ) = delete; )
709     atomic_int& operator =( const atomic_int& ) CPP0X(=delete);
710
711     int operator =( int __v__ ) volatile
712     { store( __v__ ); return __v__; }
713
714     int operator ++( int ) volatile
715     { return fetch_add( 1 ); }
716
717     int operator --( int ) volatile
718     { return fetch_sub( 1 ); }
719
720     int operator ++() volatile
721     { return fetch_add( 1 ) + 1; }
722
723     int operator --() volatile
724     { return fetch_sub( 1 ) - 1; }
725
726     int operator +=( int __v__ ) volatile
727     { return fetch_add( __v__ ) + __v__; }
728
729     int operator -=( int __v__ ) volatile
730     { return fetch_sub( __v__ ) - __v__; }
731
732     int operator &=( int __v__ ) volatile
733     { return fetch_and( __v__ ) & __v__; }
734
735     int operator |=( int __v__ ) volatile
736     { return fetch_or( __v__ ) | __v__; }
737
738     int operator ^=( int __v__ ) volatile
739     { return fetch_xor( __v__ ) ^ __v__; }
740
741     friend void atomic_store_explicit( volatile atomic_int*, int,
742                                        memory_order );
743     friend int atomic_load_explicit( volatile atomic_int*,
744                                              memory_order );
745     friend int atomic_exchange_explicit( volatile atomic_int*,
746                                              int, memory_order );
747     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_int*,
748                       int*, int, memory_order, memory_order );
749     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_int*,
750                       int*, int, memory_order, memory_order );
751     friend int atomic_fetch_add_explicit( volatile atomic_int*,
752                                                   int, memory_order );
753     friend int atomic_fetch_sub_explicit( volatile atomic_int*,
754                                                   int, memory_order );
755     friend int atomic_fetch_and_explicit( volatile atomic_int*,
756                                                   int, memory_order );
757     friend int atomic_fetch_or_explicit(  volatile atomic_int*,
758                                                   int, memory_order );
759     friend int atomic_fetch_xor_explicit( volatile atomic_int*,
760                                                   int, memory_order );
761
762 CPP0X(private:)
763 #endif
764     int __f__;
765 } atomic_int;
766
767
768 typedef struct atomic_uint
769 {
770 #ifdef __cplusplus
771     bool is_lock_free() const volatile;
772     void store( unsigned int,
773                 memory_order = memory_order_seq_cst ) volatile;
774     unsigned int load( memory_order = memory_order_seq_cst ) volatile;
775     unsigned int exchange( unsigned int,
776                       memory_order = memory_order_seq_cst ) volatile;
777     bool compare_exchange_weak( unsigned int&, unsigned int,
778                        memory_order, memory_order ) volatile;
779     bool compare_exchange_strong( unsigned int&, unsigned int,
780                        memory_order, memory_order ) volatile;
781     bool compare_exchange_weak( unsigned int&, unsigned int,
782                        memory_order = memory_order_seq_cst ) volatile;
783     bool compare_exchange_strong( unsigned int&, unsigned int,
784                        memory_order = memory_order_seq_cst ) volatile;
785     unsigned int fetch_add( unsigned int,
786                            memory_order = memory_order_seq_cst ) volatile;
787     unsigned int fetch_sub( unsigned int,
788                            memory_order = memory_order_seq_cst ) volatile;
789     unsigned int fetch_and( unsigned int,
790                            memory_order = memory_order_seq_cst ) volatile;
791     unsigned int fetch_or( unsigned int,
792                            memory_order = memory_order_seq_cst ) volatile;
793     unsigned int fetch_xor( unsigned int,
794                            memory_order = memory_order_seq_cst ) volatile;
795
796     CPP0X( atomic_uint() = default; )
797     CPP0X( constexpr atomic_uint( unsigned int __v__ ) : __f__( __v__) { } )
798     CPP0X( atomic_uint( const atomic_uint& ) = delete; )
799     atomic_uint& operator =( const atomic_uint& ) CPP0X(=delete);
800
801     unsigned int operator =( unsigned int __v__ ) volatile
802     { store( __v__ ); return __v__; }
803
804     unsigned int operator ++( int ) volatile
805     { return fetch_add( 1 ); }
806
807     unsigned int operator --( int ) volatile
808     { return fetch_sub( 1 ); }
809
810     unsigned int operator ++() volatile
811     { return fetch_add( 1 ) + 1; }
812
813     unsigned int operator --() volatile
814     { return fetch_sub( 1 ) - 1; }
815
816     unsigned int operator +=( unsigned int __v__ ) volatile
817     { return fetch_add( __v__ ) + __v__; }
818
819     unsigned int operator -=( unsigned int __v__ ) volatile
820     { return fetch_sub( __v__ ) - __v__; }
821
822     unsigned int operator &=( unsigned int __v__ ) volatile
823     { return fetch_and( __v__ ) & __v__; }
824
825     unsigned int operator |=( unsigned int __v__ ) volatile
826     { return fetch_or( __v__ ) | __v__; }
827
828     unsigned int operator ^=( unsigned int __v__ ) volatile
829     { return fetch_xor( __v__ ) ^ __v__; }
830
831     friend void atomic_store_explicit( volatile atomic_uint*, unsigned int,
832                                        memory_order );
833     friend unsigned int atomic_load_explicit( volatile atomic_uint*,
834                                              memory_order );
835     friend unsigned int atomic_exchange_explicit( volatile atomic_uint*,
836                                              unsigned int, memory_order );
837     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_uint*,
838                       unsigned int*, unsigned int, memory_order, memory_order );
839     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_uint*,
840                       unsigned int*, unsigned int, memory_order, memory_order );
841     friend unsigned int atomic_fetch_add_explicit( volatile atomic_uint*,
842                                                   unsigned int, memory_order );
843     friend unsigned int atomic_fetch_sub_explicit( volatile atomic_uint*,
844                                                   unsigned int, memory_order );
845     friend unsigned int atomic_fetch_and_explicit( volatile atomic_uint*,
846                                                   unsigned int, memory_order );
847     friend unsigned int atomic_fetch_or_explicit(  volatile atomic_uint*,
848                                                   unsigned int, memory_order );
849     friend unsigned int atomic_fetch_xor_explicit( volatile atomic_uint*,
850                                                   unsigned int, memory_order );
851
852 CPP0X(private:)
853 #endif
854     unsigned int __f__;
855 } atomic_uint;
856
857
858 typedef struct atomic_long
859 {
860 #ifdef __cplusplus
861     bool is_lock_free() const volatile;
862     void store( long,
863                 memory_order = memory_order_seq_cst ) volatile;
864     long load( memory_order = memory_order_seq_cst ) volatile;
865     long exchange( long,
866                       memory_order = memory_order_seq_cst ) volatile;
867     bool compare_exchange_weak( long&, long,
868                        memory_order, memory_order ) volatile;
869     bool compare_exchange_strong( long&, long,
870                        memory_order, memory_order ) volatile;
871     bool compare_exchange_weak( long&, long,
872                        memory_order = memory_order_seq_cst ) volatile;
873     bool compare_exchange_strong( long&, long,
874                        memory_order = memory_order_seq_cst ) volatile;
875     long fetch_add( long,
876                            memory_order = memory_order_seq_cst ) volatile;
877     long fetch_sub( long,
878                            memory_order = memory_order_seq_cst ) volatile;
879     long fetch_and( long,
880                            memory_order = memory_order_seq_cst ) volatile;
881     long fetch_or( long,
882                            memory_order = memory_order_seq_cst ) volatile;
883     long fetch_xor( long,
884                            memory_order = memory_order_seq_cst ) volatile;
885
886     CPP0X( atomic_long() = default; )
887     CPP0X( constexpr atomic_long( long __v__ ) : __f__( __v__) { } )
888     CPP0X( atomic_long( const atomic_long& ) = delete; )
889     atomic_long& operator =( const atomic_long& ) CPP0X(=delete);
890
891     long operator =( long __v__ ) volatile
892     { store( __v__ ); return __v__; }
893
894     long operator ++( int ) volatile
895     { return fetch_add( 1 ); }
896
897     long operator --( int ) volatile
898     { return fetch_sub( 1 ); }
899
900     long operator ++() volatile
901     { return fetch_add( 1 ) + 1; }
902
903     long operator --() volatile
904     { return fetch_sub( 1 ) - 1; }
905
906     long operator +=( long __v__ ) volatile
907     { return fetch_add( __v__ ) + __v__; }
908
909     long operator -=( long __v__ ) volatile
910     { return fetch_sub( __v__ ) - __v__; }
911
912     long operator &=( long __v__ ) volatile
913     { return fetch_and( __v__ ) & __v__; }
914
915     long operator |=( long __v__ ) volatile
916     { return fetch_or( __v__ ) | __v__; }
917
918     long operator ^=( long __v__ ) volatile
919     { return fetch_xor( __v__ ) ^ __v__; }
920
921     friend void atomic_store_explicit( volatile atomic_long*, long,
922                                        memory_order );
923     friend long atomic_load_explicit( volatile atomic_long*,
924                                              memory_order );
925     friend long atomic_exchange_explicit( volatile atomic_long*,
926                                              long, memory_order );
927     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_long*,
928                       long*, long, memory_order, memory_order );
929     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_long*,
930                       long*, long, memory_order, memory_order );
931     friend long atomic_fetch_add_explicit( volatile atomic_long*,
932                                                   long, memory_order );
933     friend long atomic_fetch_sub_explicit( volatile atomic_long*,
934                                                   long, memory_order );
935     friend long atomic_fetch_and_explicit( volatile atomic_long*,
936                                                   long, memory_order );
937     friend long atomic_fetch_or_explicit(  volatile atomic_long*,
938                                                   long, memory_order );
939     friend long atomic_fetch_xor_explicit( volatile atomic_long*,
940                                                   long, memory_order );
941
942 CPP0X(private:)
943 #endif
944     long __f__;
945 } atomic_long;
946
947
948 typedef struct atomic_ulong
949 {
950 #ifdef __cplusplus
951     bool is_lock_free() const volatile;
952     void store( unsigned long,
953                 memory_order = memory_order_seq_cst ) volatile;
954     unsigned long load( memory_order = memory_order_seq_cst ) volatile;
955     unsigned long exchange( unsigned long,
956                       memory_order = memory_order_seq_cst ) volatile;
957     bool compare_exchange_weak( unsigned long&, unsigned long,
958                        memory_order, memory_order ) volatile;
959     bool compare_exchange_strong( unsigned long&, unsigned long,
960                        memory_order, memory_order ) volatile;
961     bool compare_exchange_weak( unsigned long&, unsigned long,
962                        memory_order = memory_order_seq_cst ) volatile;
963     bool compare_exchange_strong( unsigned long&, unsigned long,
964                        memory_order = memory_order_seq_cst ) volatile;
965     unsigned long fetch_add( unsigned long,
966                            memory_order = memory_order_seq_cst ) volatile;
967     unsigned long fetch_sub( unsigned long,
968                            memory_order = memory_order_seq_cst ) volatile;
969     unsigned long fetch_and( unsigned long,
970                            memory_order = memory_order_seq_cst ) volatile;
971     unsigned long fetch_or( unsigned long,
972                            memory_order = memory_order_seq_cst ) volatile;
973     unsigned long fetch_xor( unsigned long,
974                            memory_order = memory_order_seq_cst ) volatile;
975
976     CPP0X( atomic_ulong() = default; )
977     CPP0X( constexpr atomic_ulong( unsigned long __v__ ) : __f__( __v__) { } )
978     CPP0X( atomic_ulong( const atomic_ulong& ) = delete; )
979     atomic_ulong& operator =( const atomic_ulong& ) CPP0X(=delete);
980
981     unsigned long operator =( unsigned long __v__ ) volatile
982     { store( __v__ ); return __v__; }
983
984     unsigned long operator ++( int ) volatile
985     { return fetch_add( 1 ); }
986
987     unsigned long operator --( int ) volatile
988     { return fetch_sub( 1 ); }
989
990     unsigned long operator ++() volatile
991     { return fetch_add( 1 ) + 1; }
992
993     unsigned long operator --() volatile
994     { return fetch_sub( 1 ) - 1; }
995
996     unsigned long operator +=( unsigned long __v__ ) volatile
997     { return fetch_add( __v__ ) + __v__; }
998
999     unsigned long operator -=( unsigned long __v__ ) volatile
1000     { return fetch_sub( __v__ ) - __v__; }
1001
1002     unsigned long operator &=( unsigned long __v__ ) volatile
1003     { return fetch_and( __v__ ) & __v__; }
1004
1005     unsigned long operator |=( unsigned long __v__ ) volatile
1006     { return fetch_or( __v__ ) | __v__; }
1007
1008     unsigned long operator ^=( unsigned long __v__ ) volatile
1009     { return fetch_xor( __v__ ) ^ __v__; }
1010
1011     friend void atomic_store_explicit( volatile atomic_ulong*, unsigned long,
1012                                        memory_order );
1013     friend unsigned long atomic_load_explicit( volatile atomic_ulong*,
1014                                              memory_order );
1015     friend unsigned long atomic_exchange_explicit( volatile atomic_ulong*,
1016                                              unsigned long, memory_order );
1017     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_ulong*,
1018                       unsigned long*, unsigned long, memory_order, memory_order );
1019     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_ulong*,
1020                       unsigned long*, unsigned long, memory_order, memory_order );
1021     friend unsigned long atomic_fetch_add_explicit( volatile atomic_ulong*,
1022                                                   unsigned long, memory_order );
1023     friend unsigned long atomic_fetch_sub_explicit( volatile atomic_ulong*,
1024                                                   unsigned long, memory_order );
1025     friend unsigned long atomic_fetch_and_explicit( volatile atomic_ulong*,
1026                                                   unsigned long, memory_order );
1027     friend unsigned long atomic_fetch_or_explicit(  volatile atomic_ulong*,
1028                                                   unsigned long, memory_order );
1029     friend unsigned long atomic_fetch_xor_explicit( volatile atomic_ulong*,
1030                                                   unsigned long, memory_order );
1031
1032 CPP0X(private:)
1033 #endif
1034     unsigned long __f__;
1035 } atomic_ulong;
1036
1037
1038 typedef struct atomic_llong
1039 {
1040 #ifdef __cplusplus
1041     bool is_lock_free() const volatile;
1042     void store( long long,
1043                 memory_order = memory_order_seq_cst ) volatile;
1044     long long load( memory_order = memory_order_seq_cst ) volatile;
1045     long long exchange( long long,
1046                       memory_order = memory_order_seq_cst ) volatile;
1047     bool compare_exchange_weak( long long&, long long,
1048                        memory_order, memory_order ) volatile;
1049     bool compare_exchange_strong( long long&, long long,
1050                        memory_order, memory_order ) volatile;
1051     bool compare_exchange_weak( long long&, long long,
1052                        memory_order = memory_order_seq_cst ) volatile;
1053     bool compare_exchange_strong( long long&, long long,
1054                        memory_order = memory_order_seq_cst ) volatile;
1055     long long fetch_add( long long,
1056                            memory_order = memory_order_seq_cst ) volatile;
1057     long long fetch_sub( long long,
1058                            memory_order = memory_order_seq_cst ) volatile;
1059     long long fetch_and( long long,
1060                            memory_order = memory_order_seq_cst ) volatile;
1061     long long fetch_or( long long,
1062                            memory_order = memory_order_seq_cst ) volatile;
1063     long long fetch_xor( long long,
1064                            memory_order = memory_order_seq_cst ) volatile;
1065
1066     CPP0X( atomic_llong() = default; )
1067     CPP0X( constexpr atomic_llong( long long __v__ ) : __f__( __v__) { } )
1068     CPP0X( atomic_llong( const atomic_llong& ) = delete; )
1069     atomic_llong& operator =( const atomic_llong& ) CPP0X(=delete);
1070
1071     long long operator =( long long __v__ ) volatile
1072     { store( __v__ ); return __v__; }
1073
1074     long long operator ++( int ) volatile
1075     { return fetch_add( 1 ); }
1076
1077     long long operator --( int ) volatile
1078     { return fetch_sub( 1 ); }
1079
1080     long long operator ++() volatile
1081     { return fetch_add( 1 ) + 1; }
1082
1083     long long operator --() volatile
1084     { return fetch_sub( 1 ) - 1; }
1085
1086     long long operator +=( long long __v__ ) volatile
1087     { return fetch_add( __v__ ) + __v__; }
1088
1089     long long operator -=( long long __v__ ) volatile
1090     { return fetch_sub( __v__ ) - __v__; }
1091
1092     long long operator &=( long long __v__ ) volatile
1093     { return fetch_and( __v__ ) & __v__; }
1094
1095     long long operator |=( long long __v__ ) volatile
1096     { return fetch_or( __v__ ) | __v__; }
1097
1098     long long operator ^=( long long __v__ ) volatile
1099     { return fetch_xor( __v__ ) ^ __v__; }
1100
1101     friend void atomic_store_explicit( volatile atomic_llong*, long long,
1102                                        memory_order );
1103     friend long long atomic_load_explicit( volatile atomic_llong*,
1104                                              memory_order );
1105     friend long long atomic_exchange_explicit( volatile atomic_llong*,
1106                                              long long, memory_order );
1107     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_llong*,
1108                       long long*, long long, memory_order, memory_order );
1109     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_llong*,
1110                       long long*, long long, memory_order, memory_order );
1111     friend long long atomic_fetch_add_explicit( volatile atomic_llong*,
1112                                                   long long, memory_order );
1113     friend long long atomic_fetch_sub_explicit( volatile atomic_llong*,
1114                                                   long long, memory_order );
1115     friend long long atomic_fetch_and_explicit( volatile atomic_llong*,
1116                                                   long long, memory_order );
1117     friend long long atomic_fetch_or_explicit(  volatile atomic_llong*,
1118                                                   long long, memory_order );
1119     friend long long atomic_fetch_xor_explicit( volatile atomic_llong*,
1120                                                   long long, memory_order );
1121
1122 CPP0X(private:)
1123 #endif
1124     long long __f__;
1125 } atomic_llong;
1126
1127
1128 typedef struct atomic_ullong
1129 {
1130 #ifdef __cplusplus
1131     bool is_lock_free() const volatile;
1132     void store( unsigned long long,
1133                 memory_order = memory_order_seq_cst ) volatile;
1134     unsigned long long load( memory_order = memory_order_seq_cst ) volatile;
1135     unsigned long long exchange( unsigned long long,
1136                       memory_order = memory_order_seq_cst ) volatile;
1137     bool compare_exchange_weak( unsigned long long&, unsigned long long,
1138                        memory_order, memory_order ) volatile;
1139     bool compare_exchange_strong( unsigned long long&, unsigned long long,
1140                        memory_order, memory_order ) volatile;
1141     bool compare_exchange_weak( unsigned long long&, unsigned long long,
1142                        memory_order = memory_order_seq_cst ) volatile;
1143     bool compare_exchange_strong( unsigned long long&, unsigned long long,
1144                        memory_order = memory_order_seq_cst ) volatile;
1145     unsigned long long fetch_add( unsigned long long,
1146                            memory_order = memory_order_seq_cst ) volatile;
1147     unsigned long long fetch_sub( unsigned long long,
1148                            memory_order = memory_order_seq_cst ) volatile;
1149     unsigned long long fetch_and( unsigned long long,
1150                            memory_order = memory_order_seq_cst ) volatile;
1151     unsigned long long fetch_or( unsigned long long,
1152                            memory_order = memory_order_seq_cst ) volatile;
1153     unsigned long long fetch_xor( unsigned long long,
1154                            memory_order = memory_order_seq_cst ) volatile;
1155
1156     CPP0X( atomic_ullong() = default; )
1157     CPP0X( constexpr atomic_ullong( unsigned long long __v__ ) : __f__( __v__) { } )
1158     CPP0X( atomic_ullong( const atomic_ullong& ) = delete; )
1159     atomic_ullong& operator =( const atomic_ullong& ) CPP0X(=delete);
1160
1161     unsigned long long operator =( unsigned long long __v__ ) volatile
1162     { store( __v__ ); return __v__; }
1163
1164     unsigned long long operator ++( int ) volatile
1165     { return fetch_add( 1 ); }
1166
1167     unsigned long long operator --( int ) volatile
1168     { return fetch_sub( 1 ); }
1169
1170     unsigned long long operator ++() volatile
1171     { return fetch_add( 1 ) + 1; }
1172
1173     unsigned long long operator --() volatile
1174     { return fetch_sub( 1 ) - 1; }
1175
1176     unsigned long long operator +=( unsigned long long __v__ ) volatile
1177     { return fetch_add( __v__ ) + __v__; }
1178
1179     unsigned long long operator -=( unsigned long long __v__ ) volatile
1180     { return fetch_sub( __v__ ) - __v__; }
1181
1182     unsigned long long operator &=( unsigned long long __v__ ) volatile
1183     { return fetch_and( __v__ ) & __v__; }
1184
1185     unsigned long long operator |=( unsigned long long __v__ ) volatile
1186     { return fetch_or( __v__ ) | __v__; }
1187
1188     unsigned long long operator ^=( unsigned long long __v__ ) volatile
1189     { return fetch_xor( __v__ ) ^ __v__; }
1190
1191     friend void atomic_store_explicit( volatile atomic_ullong*, unsigned long long,
1192                                        memory_order );
1193     friend unsigned long long atomic_load_explicit( volatile atomic_ullong*,
1194                                              memory_order );
1195     friend unsigned long long atomic_exchange_explicit( volatile atomic_ullong*,
1196                                              unsigned long long, memory_order );
1197     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_ullong*,
1198                       unsigned long long*, unsigned long long, memory_order, memory_order );
1199     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_ullong*,
1200                       unsigned long long*, unsigned long long, memory_order, memory_order );
1201     friend unsigned long long atomic_fetch_add_explicit( volatile atomic_ullong*,
1202                                                   unsigned long long, memory_order );
1203     friend unsigned long long atomic_fetch_sub_explicit( volatile atomic_ullong*,
1204                                                   unsigned long long, memory_order );
1205     friend unsigned long long atomic_fetch_and_explicit( volatile atomic_ullong*,
1206                                                   unsigned long long, memory_order );
1207     friend unsigned long long atomic_fetch_or_explicit(  volatile atomic_ullong*,
1208                                                   unsigned long long, memory_order );
1209     friend unsigned long long atomic_fetch_xor_explicit( volatile atomic_ullong*,
1210                                                   unsigned long long, memory_order );
1211
1212 CPP0X(private:)
1213 #endif
1214     unsigned long long __f__;
1215 } atomic_ullong;
1216
1217
1218 typedef atomic_schar atomic_int_least8_t;
1219 typedef atomic_uchar atomic_uint_least8_t;
1220 typedef atomic_short atomic_int_least16_t;
1221 typedef atomic_ushort atomic_uint_least16_t;
1222 typedef atomic_int atomic_int_least32_t;
1223 typedef atomic_uint atomic_uint_least32_t;
1224 typedef atomic_llong atomic_int_least64_t;
1225 typedef atomic_ullong atomic_uint_least64_t;
1226
1227 typedef atomic_schar atomic_int_fast8_t;
1228 typedef atomic_uchar atomic_uint_fast8_t;
1229 typedef atomic_short atomic_int_fast16_t;
1230 typedef atomic_ushort atomic_uint_fast16_t;
1231 typedef atomic_int atomic_int_fast32_t;
1232 typedef atomic_uint atomic_uint_fast32_t;
1233 typedef atomic_llong atomic_int_fast64_t;
1234 typedef atomic_ullong atomic_uint_fast64_t;
1235
1236 typedef atomic_long atomic_intptr_t;
1237 typedef atomic_ulong atomic_uintptr_t;
1238
1239 typedef atomic_long atomic_ssize_t;
1240 typedef atomic_ulong atomic_size_t;
1241
1242 typedef atomic_long atomic_ptrdiff_t;
1243
1244 typedef atomic_llong atomic_intmax_t;
1245 typedef atomic_ullong atomic_uintmax_t;
1246
1247
1248 #ifdef __cplusplus
1249
1250
1251 typedef struct atomic_wchar_t
1252 {
1253 #ifdef __cplusplus
1254     bool is_lock_free() const volatile;
1255     void store( wchar_t, memory_order = memory_order_seq_cst ) volatile;
1256     wchar_t load( memory_order = memory_order_seq_cst ) volatile;
1257     wchar_t exchange( wchar_t,
1258                       memory_order = memory_order_seq_cst ) volatile;
1259     bool compare_exchange_weak( wchar_t&, wchar_t,
1260                        memory_order, memory_order ) volatile;
1261     bool compare_exchange_strong( wchar_t&, wchar_t,
1262                        memory_order, memory_order ) volatile;
1263     bool compare_exchange_weak( wchar_t&, wchar_t,
1264                        memory_order = memory_order_seq_cst ) volatile;
1265     bool compare_exchange_strong( wchar_t&, wchar_t,
1266                        memory_order = memory_order_seq_cst ) volatile;
1267     wchar_t fetch_add( wchar_t,
1268                            memory_order = memory_order_seq_cst ) volatile;
1269     wchar_t fetch_sub( wchar_t,
1270                            memory_order = memory_order_seq_cst ) volatile;
1271     wchar_t fetch_and( wchar_t,
1272                            memory_order = memory_order_seq_cst ) volatile;
1273     wchar_t fetch_or( wchar_t,
1274                            memory_order = memory_order_seq_cst ) volatile;
1275     wchar_t fetch_xor( wchar_t,
1276                            memory_order = memory_order_seq_cst ) volatile;
1277
1278     CPP0X( atomic_wchar_t() = default; )
1279     CPP0X( constexpr atomic_wchar_t( wchar_t __v__ ) : __f__( __v__) { } )
1280     CPP0X( atomic_wchar_t( const atomic_wchar_t& ) = delete; )
1281     atomic_wchar_t& operator =( const atomic_wchar_t& ) CPP0X(=delete);
1282
1283     wchar_t operator =( wchar_t __v__ ) volatile
1284     { store( __v__ ); return __v__; }
1285
1286     wchar_t operator ++( int ) volatile
1287     { return fetch_add( 1 ); }
1288
1289     wchar_t operator --( int ) volatile
1290     { return fetch_sub( 1 ); }
1291
1292     wchar_t operator ++() volatile
1293     { return fetch_add( 1 ) + 1; }
1294
1295     wchar_t operator --() volatile
1296     { return fetch_sub( 1 ) - 1; }
1297
1298     wchar_t operator +=( wchar_t __v__ ) volatile
1299     { return fetch_add( __v__ ) + __v__; }
1300
1301     wchar_t operator -=( wchar_t __v__ ) volatile
1302     { return fetch_sub( __v__ ) - __v__; }
1303
1304     wchar_t operator &=( wchar_t __v__ ) volatile
1305     { return fetch_and( __v__ ) & __v__; }
1306
1307     wchar_t operator |=( wchar_t __v__ ) volatile
1308     { return fetch_or( __v__ ) | __v__; }
1309
1310     wchar_t operator ^=( wchar_t __v__ ) volatile
1311     { return fetch_xor( __v__ ) ^ __v__; }
1312
1313     friend void atomic_store_explicit( volatile atomic_wchar_t*, wchar_t,
1314                                        memory_order );
1315     friend wchar_t atomic_load_explicit( volatile atomic_wchar_t*,
1316                                              memory_order );
1317     friend wchar_t atomic_exchange_explicit( volatile atomic_wchar_t*,
1318                                              wchar_t, memory_order );
1319     friend bool atomic_compare_exchange_weak_explicit( volatile atomic_wchar_t*,
1320                     wchar_t*, wchar_t, memory_order, memory_order );
1321     friend bool atomic_compare_exchange_strong_explicit( volatile atomic_wchar_t*,
1322                     wchar_t*, wchar_t, memory_order, memory_order );
1323     friend wchar_t atomic_fetch_add_explicit( volatile atomic_wchar_t*,
1324                                                   wchar_t, memory_order );
1325     friend wchar_t atomic_fetch_sub_explicit( volatile atomic_wchar_t*,
1326                                                   wchar_t, memory_order );
1327     friend wchar_t atomic_fetch_and_explicit( volatile atomic_wchar_t*,
1328                                                   wchar_t, memory_order );
1329     friend wchar_t atomic_fetch_or_explicit( volatile atomic_wchar_t*,
1330                                                   wchar_t, memory_order );
1331     friend wchar_t atomic_fetch_xor_explicit( volatile atomic_wchar_t*,
1332                                                   wchar_t, memory_order );
1333
1334 CPP0X(private:)
1335 #endif
1336     wchar_t __f__;
1337 } atomic_wchar_t;
1338
1339
1340 #else
1341
1342 typedef atomic_int_least16_t atomic_char16_t;
1343 typedef atomic_int_least32_t atomic_char32_t;
1344 typedef atomic_int_least32_t atomic_wchar_t;
1345
1346 #endif
1347
1348
1349 #ifdef __cplusplus
1350
1351 template< typename T >
1352 struct atomic
1353 {
1354 #ifdef __cplusplus
1355
1356     bool is_lock_free() const volatile;
1357     void store( T, memory_order = memory_order_seq_cst ) volatile;
1358     T load( memory_order = memory_order_seq_cst ) volatile;
1359     T exchange( T __v__, memory_order = memory_order_seq_cst ) volatile;
1360     bool compare_exchange_weak( T&, T, memory_order, memory_order ) volatile;
1361     bool compare_exchange_strong( T&, T, memory_order, memory_order ) volatile;
1362     bool compare_exchange_weak( T&, T, memory_order = memory_order_seq_cst ) volatile;
1363     bool compare_exchange_strong( T&, T, memory_order = memory_order_seq_cst ) volatile;
1364
1365     CPP0X( atomic() = default; )
1366     CPP0X( constexpr explicit atomic( T __v__ ) : __f__( __v__ ) { } )
1367     CPP0X( atomic( const atomic& ) = delete; )
1368     atomic& operator =( const atomic& ) CPP0X(=delete);
1369
1370     T operator =( T __v__ ) volatile
1371     { store( __v__ ); return __v__; }
1372
1373 CPP0X(private:)
1374 #endif
1375     T __f__;
1376 };
1377
1378 #endif
1379
1380 #ifdef __cplusplus
1381
1382 template<typename T> struct atomic< T* > : atomic_address
1383 {
1384     T* load( memory_order = memory_order_seq_cst ) volatile;
1385     T* exchange( T*, memory_order = memory_order_seq_cst ) volatile;
1386     bool compare_exchange_weak( T*&, T*, memory_order, memory_order ) volatile;
1387     bool compare_exchange_strong( T*&, T*, memory_order, memory_order ) volatile;
1388     bool compare_exchange_weak( T*&, T*,
1389                        memory_order = memory_order_seq_cst ) volatile;
1390     bool compare_exchange_strong( T*&, T*,
1391                        memory_order = memory_order_seq_cst ) volatile;
1392     T* fetch_add( ptrdiff_t, memory_order = memory_order_seq_cst ) volatile;
1393     T* fetch_sub( ptrdiff_t, memory_order = memory_order_seq_cst ) volatile;
1394
1395     CPP0X( atomic() = default; )
1396     CPP0X( constexpr explicit atomic( T __v__ ) : atomic_address( __v__ ) { } )
1397     CPP0X( atomic( const atomic& ) = delete; )
1398     atomic& operator =( const atomic& ) CPP0X(=delete);
1399
1400     T* operator =( T* __v__ ) volatile
1401     { store( __v__ ); return __v__; }
1402
1403     T* operator ++( int ) volatile
1404     { return fetch_add( 1 ); }
1405
1406     T* operator --( int ) volatile
1407     { return fetch_sub( 1 ); }
1408
1409     T* operator ++() volatile
1410     { return fetch_add( 1 ) + 1; }
1411
1412     T* operator --() volatile
1413     { return fetch_sub( 1 ) - 1; }
1414
1415     T* operator +=( T* __v__ ) volatile
1416     { return fetch_add( __v__ ) + __v__; }
1417
1418     T* operator -=( T* __v__ ) volatile
1419     { return fetch_sub( __v__ ) - __v__; }
1420 };
1421
1422 #endif
1423
1424 #ifdef __cplusplus
1425
1426
1427 template<> struct atomic< bool > : atomic_bool
1428 {
1429     CPP0X( atomic() = default; )
1430     CPP0X( constexpr explicit atomic( bool __v__ )
1431     : atomic_bool( __v__ ) { } )
1432     CPP0X( atomic( const atomic& ) = delete; )
1433     atomic& operator =( const atomic& ) CPP0X(=delete);
1434
1435     bool operator =( bool __v__ ) volatile
1436     { store( __v__ ); return __v__; }
1437 };
1438
1439
1440 template<> struct atomic< void* > : atomic_address
1441 {
1442     CPP0X( atomic() = default; )
1443     CPP0X( constexpr explicit atomic( void* __v__ )
1444     : atomic_address( __v__ ) { } )
1445     CPP0X( atomic( const atomic& ) = delete; )
1446     atomic& operator =( const atomic& ) CPP0X(=delete);
1447
1448     void* operator =( void* __v__ ) volatile
1449     { store( __v__ ); return __v__; }
1450 };
1451
1452
1453 template<> struct atomic< char > : atomic_char
1454 {
1455     CPP0X( atomic() = default; )
1456     CPP0X( constexpr explicit atomic( char __v__ )
1457     : atomic_char( __v__ ) { } )
1458     CPP0X( atomic( const atomic& ) = delete; )
1459     atomic& operator =( const atomic& ) CPP0X(=delete);
1460
1461     char operator =( char __v__ ) volatile
1462     { store( __v__ ); return __v__; }
1463 };
1464
1465
1466 template<> struct atomic< signed char > : atomic_schar
1467 {
1468     CPP0X( atomic() = default; )
1469     CPP0X( constexpr explicit atomic( signed char __v__ )
1470     : atomic_schar( __v__ ) { } )
1471     CPP0X( atomic( const atomic& ) = delete; )
1472     atomic& operator =( const atomic& ) CPP0X(=delete);
1473
1474     signed char operator =( signed char __v__ ) volatile
1475     { store( __v__ ); return __v__; }
1476 };
1477
1478
1479 template<> struct atomic< unsigned char > : atomic_uchar
1480 {
1481     CPP0X( atomic() = default; )
1482     CPP0X( constexpr explicit atomic( unsigned char __v__ )
1483     : atomic_uchar( __v__ ) { } )
1484     CPP0X( atomic( const atomic& ) = delete; )
1485     atomic& operator =( const atomic& ) CPP0X(=delete);
1486
1487     unsigned char operator =( unsigned char __v__ ) volatile
1488     { store( __v__ ); return __v__; }
1489 };
1490
1491
1492 template<> struct atomic< short > : atomic_short
1493 {
1494     CPP0X( atomic() = default; )
1495     CPP0X( constexpr explicit atomic( short __v__ )
1496     : atomic_short( __v__ ) { } )
1497     CPP0X( atomic( const atomic& ) = delete; )
1498     atomic& operator =( const atomic& ) CPP0X(=delete);
1499
1500     short operator =( short __v__ ) volatile
1501     { store( __v__ ); return __v__; }
1502 };
1503
1504
1505 template<> struct atomic< unsigned short > : atomic_ushort
1506 {
1507     CPP0X( atomic() = default; )
1508     CPP0X( constexpr explicit atomic( unsigned short __v__ )
1509     : atomic_ushort( __v__ ) { } )
1510     CPP0X( atomic( const atomic& ) = delete; )
1511     atomic& operator =( const atomic& ) CPP0X(=delete);
1512
1513     unsigned short operator =( unsigned short __v__ ) volatile
1514     { store( __v__ ); return __v__; }
1515 };
1516
1517
1518 template<> struct atomic< int > : atomic_int
1519 {
1520     CPP0X( atomic() = default; )
1521     CPP0X( constexpr explicit atomic( int __v__ )
1522     : atomic_int( __v__ ) { } )
1523     CPP0X( atomic( const atomic& ) = delete; )
1524     atomic& operator =( const atomic& ) CPP0X(=delete);
1525
1526     int operator =( int __v__ ) volatile
1527     { store( __v__ ); return __v__; }
1528 };
1529
1530
1531 template<> struct atomic< unsigned int > : atomic_uint
1532 {
1533     CPP0X( atomic() = default; )
1534     CPP0X( constexpr explicit atomic( unsigned int __v__ )
1535     : atomic_uint( __v__ ) { } )
1536     CPP0X( atomic( const atomic& ) = delete; )
1537     atomic& operator =( const atomic& ) CPP0X(=delete);
1538
1539     unsigned int operator =( unsigned int __v__ ) volatile
1540     { store( __v__ ); return __v__; }
1541 };
1542
1543
1544 template<> struct atomic< long > : atomic_long
1545 {
1546     CPP0X( atomic() = default; )
1547     CPP0X( constexpr explicit atomic( long __v__ )
1548     : atomic_long( __v__ ) { } )
1549     CPP0X( atomic( const atomic& ) = delete; )
1550     atomic& operator =( const atomic& ) CPP0X(=delete);
1551
1552     long operator =( long __v__ ) volatile
1553     { store( __v__ ); return __v__; }
1554 };
1555
1556
1557 template<> struct atomic< unsigned long > : atomic_ulong
1558 {
1559     CPP0X( atomic() = default; )
1560     CPP0X( constexpr explicit atomic( unsigned long __v__ )
1561     : atomic_ulong( __v__ ) { } )
1562     CPP0X( atomic( const atomic& ) = delete; )
1563     atomic& operator =( const atomic& ) CPP0X(=delete);
1564
1565     unsigned long operator =( unsigned long __v__ ) volatile
1566     { store( __v__ ); return __v__; }
1567 };
1568
1569
1570 template<> struct atomic< long long > : atomic_llong
1571 {
1572     CPP0X( atomic() = default; )
1573     CPP0X( constexpr explicit atomic( long long __v__ )
1574     : atomic_llong( __v__ ) { } )
1575     CPP0X( atomic( const atomic& ) = delete; )
1576     atomic& operator =( const atomic& ) CPP0X(=delete);
1577
1578     long long operator =( long long __v__ ) volatile
1579     { store( __v__ ); return __v__; }
1580 };
1581
1582
1583 template<> struct atomic< unsigned long long > : atomic_ullong
1584 {
1585     CPP0X( atomic() = default; )
1586     CPP0X( constexpr explicit atomic( unsigned long long __v__ )
1587     : atomic_ullong( __v__ ) { } )
1588     CPP0X( atomic( const atomic& ) = delete; )
1589     atomic& operator =( const atomic& ) CPP0X(=delete);
1590
1591     unsigned long long operator =( unsigned long long __v__ ) volatile
1592     { store( __v__ ); return __v__; }
1593 };
1594
1595
1596 template<> struct atomic< wchar_t > : atomic_wchar_t
1597 {
1598     CPP0X( atomic() = default; )
1599     CPP0X( constexpr explicit atomic( wchar_t __v__ )
1600     : atomic_wchar_t( __v__ ) { } )
1601     CPP0X( atomic( const atomic& ) = delete; )
1602     atomic& operator =( const atomic& ) CPP0X(=delete);
1603
1604     wchar_t operator =( wchar_t __v__ ) volatile
1605     { store( __v__ ); return __v__; }
1606 };
1607
1608
1609 #endif
1610
1611
1612 #ifdef __cplusplus
1613
1614
1615 inline bool atomic_is_lock_free
1616 ( const volatile atomic_bool* __a__ )
1617 { return false; }
1618
1619 inline bool atomic_load_explicit
1620 ( volatile atomic_bool* __a__, memory_order __x__ )
1621 { return _ATOMIC_LOAD_( __a__, __x__ ); }
1622
1623 inline bool atomic_load
1624 ( volatile atomic_bool* __a__ ) { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
1625
1626 inline void atomic_init
1627 ( volatile atomic_bool* __a__, bool __m__ )
1628 { _ATOMIC_INIT_( __a__, __m__ ); }
1629
1630 inline void atomic_store_explicit
1631 ( volatile atomic_bool* __a__, bool __m__, memory_order __x__ )
1632 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
1633
1634 inline void atomic_store
1635 ( volatile atomic_bool* __a__, bool __m__ )
1636 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
1637
1638 inline bool atomic_exchange_explicit
1639 ( volatile atomic_bool* __a__, bool __m__, memory_order __x__ )
1640 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
1641
1642 inline bool atomic_exchange
1643 ( volatile atomic_bool* __a__, bool __m__ )
1644 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
1645
1646 inline bool atomic_compare_exchange_weak_explicit
1647 ( volatile atomic_bool* __a__, bool* __e__, bool __m__,
1648   memory_order __x__, memory_order __y__ )
1649 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
1650
1651 inline bool atomic_compare_exchange_strong_explicit
1652 ( volatile atomic_bool* __a__, bool* __e__, bool __m__,
1653   memory_order __x__, memory_order __y__ )
1654 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
1655
1656 inline bool atomic_compare_exchange_weak
1657 ( volatile atomic_bool* __a__, bool* __e__, bool __m__ )
1658 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
1659                  memory_order_seq_cst, memory_order_seq_cst ); }
1660
1661 inline bool atomic_compare_exchange_strong
1662 ( volatile atomic_bool* __a__, bool* __e__, bool __m__ )
1663 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
1664                  memory_order_seq_cst, memory_order_seq_cst ); }
1665
1666
1667 inline bool atomic_is_lock_free( const volatile atomic_address* __a__ )
1668 { return false; }
1669
1670 inline void* atomic_load_explicit
1671 ( volatile atomic_address* __a__, memory_order __x__ )
1672 { return _ATOMIC_LOAD_( __a__, __x__ ); }
1673
1674 inline void* atomic_load( volatile atomic_address* __a__ )
1675 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
1676
1677 inline void atomic_init
1678 ( volatile atomic_address* __a__, void* __m__ )
1679 { _ATOMIC_INIT_( __a__, __m__ ); }
1680
1681 inline void atomic_store_explicit
1682 ( volatile atomic_address* __a__, void* __m__, memory_order __x__ )
1683 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
1684
1685 inline void atomic_store
1686 ( volatile atomic_address* __a__, void* __m__ )
1687 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
1688
1689 inline void* atomic_exchange_explicit
1690 ( volatile atomic_address* __a__, void* __m__, memory_order __x__ )
1691 { return _ATOMIC_MODIFY_( __a__, =, __m__,  __x__ ); }
1692
1693 inline void* atomic_exchange
1694 ( volatile atomic_address* __a__, void* __m__ )
1695 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
1696
1697 inline bool atomic_compare_exchange_weak_explicit
1698 ( volatile atomic_address* __a__, void** __e__, void* __m__,
1699   memory_order __x__, memory_order __y__ )
1700 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
1701
1702 inline bool atomic_compare_exchange_strong_explicit
1703 ( volatile atomic_address* __a__, void** __e__, void* __m__,
1704   memory_order __x__, memory_order __y__ )
1705 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
1706
1707 inline bool atomic_compare_exchange_weak
1708 ( volatile atomic_address* __a__, void** __e__, void* __m__ )
1709 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
1710                  memory_order_seq_cst, memory_order_seq_cst ); }
1711
1712 inline bool atomic_compare_exchange_strong
1713 ( volatile atomic_address* __a__, void** __e__, void* __m__ )
1714 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
1715                  memory_order_seq_cst, memory_order_seq_cst ); }
1716
1717
1718 inline bool atomic_is_lock_free( const volatile atomic_char* __a__ )
1719 { return false; }
1720
1721 inline char atomic_load_explicit
1722 ( volatile atomic_char* __a__, memory_order __x__ )
1723 { return _ATOMIC_LOAD_( __a__, __x__ ); }
1724
1725 inline char atomic_load( volatile atomic_char* __a__ )
1726 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
1727
1728 inline void atomic_init
1729 ( volatile atomic_char* __a__, char __m__ )
1730 { _ATOMIC_INIT_( __a__, __m__ ); }
1731
1732 inline void atomic_store_explicit
1733 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
1734 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
1735
1736 inline void atomic_store
1737 ( volatile atomic_char* __a__, char __m__ )
1738 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
1739
1740 inline char atomic_exchange_explicit
1741 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
1742 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
1743
1744 inline char atomic_exchange
1745 ( volatile atomic_char* __a__, char __m__ )
1746 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
1747
1748 inline bool atomic_compare_exchange_weak_explicit
1749 ( volatile atomic_char* __a__, char* __e__, char __m__,
1750   memory_order __x__, memory_order __y__ )
1751 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
1752
1753 inline bool atomic_compare_exchange_strong_explicit
1754 ( volatile atomic_char* __a__, char* __e__, char __m__,
1755   memory_order __x__, memory_order __y__ )
1756 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
1757
1758 inline bool atomic_compare_exchange_weak
1759 ( volatile atomic_char* __a__, char* __e__, char __m__ )
1760 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
1761                  memory_order_seq_cst, memory_order_seq_cst ); }
1762
1763 inline bool atomic_compare_exchange_strong
1764 ( volatile atomic_char* __a__, char* __e__, char __m__ )
1765 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
1766                  memory_order_seq_cst, memory_order_seq_cst ); }
1767
1768
1769 inline bool atomic_is_lock_free( const volatile atomic_schar* __a__ )
1770 { return false; }
1771
1772 inline signed char atomic_load_explicit
1773 ( volatile atomic_schar* __a__, memory_order __x__ )
1774 { return _ATOMIC_LOAD_( __a__, __x__ ); }
1775
1776 inline signed char atomic_load( volatile atomic_schar* __a__ )
1777 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
1778
1779 inline void atomic_init
1780 ( volatile atomic_schar* __a__, signed char __m__ )
1781 { _ATOMIC_INIT_( __a__, __m__ ); }
1782
1783 inline void atomic_store_explicit
1784 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
1785 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
1786
1787 inline void atomic_store
1788 ( volatile atomic_schar* __a__, signed char __m__ )
1789 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
1790
1791 inline signed char atomic_exchange_explicit
1792 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
1793 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
1794
1795 inline signed char atomic_exchange
1796 ( volatile atomic_schar* __a__, signed char __m__ )
1797 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
1798
1799 inline bool atomic_compare_exchange_weak_explicit
1800 ( volatile atomic_schar* __a__, signed char* __e__, signed char __m__,
1801   memory_order __x__, memory_order __y__ )
1802 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
1803
1804 inline bool atomic_compare_exchange_strong_explicit
1805 ( volatile atomic_schar* __a__, signed char* __e__, signed char __m__,
1806   memory_order __x__, memory_order __y__ )
1807 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
1808
1809 inline bool atomic_compare_exchange_weak
1810 ( volatile atomic_schar* __a__, signed char* __e__, signed char __m__ )
1811 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
1812                  memory_order_seq_cst, memory_order_seq_cst ); }
1813
1814 inline bool atomic_compare_exchange_strong
1815 ( volatile atomic_schar* __a__, signed char* __e__, signed char __m__ )
1816 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
1817                  memory_order_seq_cst, memory_order_seq_cst ); }
1818
1819
1820 inline bool atomic_is_lock_free( const volatile atomic_uchar* __a__ )
1821 { return false; }
1822
1823 inline unsigned char atomic_load_explicit
1824 ( volatile atomic_uchar* __a__, memory_order __x__ )
1825 { return _ATOMIC_LOAD_( __a__, __x__ ); }
1826
1827 inline unsigned char atomic_load( volatile atomic_uchar* __a__ )
1828 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
1829
1830 inline void atomic_init
1831 ( volatile atomic_uchar* __a__, unsigned char __m__ )
1832 { _ATOMIC_INIT_( __a__, __m__ ); }
1833
1834 inline void atomic_store_explicit
1835 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
1836 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
1837
1838 inline void atomic_store
1839 ( volatile atomic_uchar* __a__, unsigned char __m__ )
1840 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
1841
1842 inline unsigned char atomic_exchange_explicit
1843 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
1844 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
1845
1846 inline unsigned char atomic_exchange
1847 ( volatile atomic_uchar* __a__, unsigned char __m__ )
1848 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
1849
1850 inline bool atomic_compare_exchange_weak_explicit
1851 ( volatile atomic_uchar* __a__, unsigned char* __e__, unsigned char __m__,
1852   memory_order __x__, memory_order __y__ )
1853 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
1854
1855 inline bool atomic_compare_exchange_strong_explicit
1856 ( volatile atomic_uchar* __a__, unsigned char* __e__, unsigned char __m__,
1857   memory_order __x__, memory_order __y__ )
1858 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
1859
1860 inline bool atomic_compare_exchange_weak
1861 ( volatile atomic_uchar* __a__, unsigned char* __e__, unsigned char __m__ )
1862 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
1863                  memory_order_seq_cst, memory_order_seq_cst ); }
1864
1865 inline bool atomic_compare_exchange_strong
1866 ( volatile atomic_uchar* __a__, unsigned char* __e__, unsigned char __m__ )
1867 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
1868                  memory_order_seq_cst, memory_order_seq_cst ); }
1869
1870
1871 inline bool atomic_is_lock_free( const volatile atomic_short* __a__ )
1872 { return false; }
1873
1874 inline short atomic_load_explicit
1875 ( volatile atomic_short* __a__, memory_order __x__ )
1876 { return _ATOMIC_LOAD_( __a__, __x__ ); }
1877
1878 inline short atomic_load( volatile atomic_short* __a__ )
1879 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
1880
1881 inline void atomic_init
1882 ( volatile atomic_short* __a__, short __m__ )
1883 { _ATOMIC_INIT_( __a__, __m__ ); }
1884
1885 inline void atomic_store_explicit
1886 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
1887 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
1888
1889 inline void atomic_store
1890 ( volatile atomic_short* __a__, short __m__ )
1891 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
1892
1893 inline short atomic_exchange_explicit
1894 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
1895 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
1896
1897 inline short atomic_exchange
1898 ( volatile atomic_short* __a__, short __m__ )
1899 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
1900
1901 inline bool atomic_compare_exchange_weak_explicit
1902 ( volatile atomic_short* __a__, short* __e__, short __m__,
1903   memory_order __x__, memory_order __y__ )
1904 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
1905
1906 inline bool atomic_compare_exchange_strong_explicit
1907 ( volatile atomic_short* __a__, short* __e__, short __m__,
1908   memory_order __x__, memory_order __y__ )
1909 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
1910
1911 inline bool atomic_compare_exchange_weak
1912 ( volatile atomic_short* __a__, short* __e__, short __m__ )
1913 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
1914                  memory_order_seq_cst, memory_order_seq_cst ); }
1915
1916 inline bool atomic_compare_exchange_strong
1917 ( volatile atomic_short* __a__, short* __e__, short __m__ )
1918 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
1919                  memory_order_seq_cst, memory_order_seq_cst ); }
1920
1921
1922 inline bool atomic_is_lock_free( const volatile atomic_ushort* __a__ )
1923 { return false; }
1924
1925 inline unsigned short atomic_load_explicit
1926 ( volatile atomic_ushort* __a__, memory_order __x__ )
1927 { return _ATOMIC_LOAD_( __a__, __x__ ); }
1928
1929 inline unsigned short atomic_load( volatile atomic_ushort* __a__ )
1930 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
1931
1932 inline void atomic_init
1933 ( volatile atomic_ushort* __a__, unsigned short __m__ )
1934 { _ATOMIC_INIT_( __a__, __m__ ); }
1935
1936 inline void atomic_store_explicit
1937 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
1938 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
1939
1940 inline void atomic_store
1941 ( volatile atomic_ushort* __a__, unsigned short __m__ )
1942 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
1943
1944 inline unsigned short atomic_exchange_explicit
1945 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
1946 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
1947
1948 inline unsigned short atomic_exchange
1949 ( volatile atomic_ushort* __a__, unsigned short __m__ )
1950 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
1951
1952 inline bool atomic_compare_exchange_weak_explicit
1953 ( volatile atomic_ushort* __a__, unsigned short* __e__, unsigned short __m__,
1954   memory_order __x__, memory_order __y__ )
1955 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
1956
1957 inline bool atomic_compare_exchange_strong_explicit
1958 ( volatile atomic_ushort* __a__, unsigned short* __e__, unsigned short __m__,
1959   memory_order __x__, memory_order __y__ )
1960 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
1961
1962 inline bool atomic_compare_exchange_weak
1963 ( volatile atomic_ushort* __a__, unsigned short* __e__, unsigned short __m__ )
1964 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
1965                  memory_order_seq_cst, memory_order_seq_cst ); }
1966
1967 inline bool atomic_compare_exchange_strong
1968 ( volatile atomic_ushort* __a__, unsigned short* __e__, unsigned short __m__ )
1969 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
1970                  memory_order_seq_cst, memory_order_seq_cst ); }
1971
1972
1973 inline bool atomic_is_lock_free( const volatile atomic_int* __a__ )
1974 { return false; }
1975
1976 inline int atomic_load_explicit
1977 ( volatile atomic_int* __a__, memory_order __x__ )
1978 { return _ATOMIC_LOAD_( __a__, __x__ ); }
1979
1980 inline int atomic_load( volatile atomic_int* __a__ )
1981 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
1982
1983 inline void atomic_init
1984 ( volatile atomic_int* __a__, int __m__ )
1985 { _ATOMIC_INIT_( __a__, __m__ ); }
1986
1987 inline void atomic_store_explicit
1988 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
1989 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
1990
1991 inline void atomic_store
1992 ( volatile atomic_int* __a__, int __m__ )
1993 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
1994
1995 inline int atomic_exchange_explicit
1996 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
1997 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
1998
1999 inline int atomic_exchange
2000 ( volatile atomic_int* __a__, int __m__ )
2001 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
2002
2003 inline bool atomic_compare_exchange_weak_explicit
2004 ( volatile atomic_int* __a__, int* __e__, int __m__,
2005   memory_order __x__, memory_order __y__ )
2006 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
2007
2008 inline bool atomic_compare_exchange_strong_explicit
2009 ( volatile atomic_int* __a__, int* __e__, int __m__,
2010   memory_order __x__, memory_order __y__ )
2011 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
2012
2013 inline bool atomic_compare_exchange_weak
2014 ( volatile atomic_int* __a__, int* __e__, int __m__ )
2015 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
2016                  memory_order_seq_cst, memory_order_seq_cst ); }
2017
2018 inline bool atomic_compare_exchange_strong
2019 ( volatile atomic_int* __a__, int* __e__, int __m__ )
2020 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
2021                  memory_order_seq_cst, memory_order_seq_cst ); }
2022
2023
2024 inline bool atomic_is_lock_free( const volatile atomic_uint* __a__ )
2025 { return false; }
2026
2027 inline unsigned int atomic_load_explicit
2028 ( volatile atomic_uint* __a__, memory_order __x__ )
2029 { return _ATOMIC_LOAD_( __a__, __x__ ); }
2030
2031 inline unsigned int atomic_load( volatile atomic_uint* __a__ )
2032 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
2033
2034 inline void atomic_init
2035 ( volatile atomic_uint* __a__, unsigned int __m__ )
2036 { _ATOMIC_INIT_( __a__, __m__ ); }
2037
2038 inline void atomic_store_explicit
2039 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2040 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
2041
2042 inline void atomic_store
2043 ( volatile atomic_uint* __a__, unsigned int __m__ )
2044 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
2045
2046 inline unsigned int atomic_exchange_explicit
2047 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2048 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
2049
2050 inline unsigned int atomic_exchange
2051 ( volatile atomic_uint* __a__, unsigned int __m__ )
2052 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
2053
2054 inline bool atomic_compare_exchange_weak_explicit
2055 ( volatile atomic_uint* __a__, unsigned int* __e__, unsigned int __m__,
2056   memory_order __x__, memory_order __y__ )
2057 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
2058
2059 inline bool atomic_compare_exchange_strong_explicit
2060 ( volatile atomic_uint* __a__, unsigned int* __e__, unsigned int __m__,
2061   memory_order __x__, memory_order __y__ )
2062 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
2063
2064 inline bool atomic_compare_exchange_weak
2065 ( volatile atomic_uint* __a__, unsigned int* __e__, unsigned int __m__ )
2066 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
2067                  memory_order_seq_cst, memory_order_seq_cst ); }
2068
2069 inline bool atomic_compare_exchange_strong
2070 ( volatile atomic_uint* __a__, unsigned int* __e__, unsigned int __m__ )
2071 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
2072                  memory_order_seq_cst, memory_order_seq_cst ); }
2073
2074
2075 inline bool atomic_is_lock_free( const volatile atomic_long* __a__ )
2076 { return false; }
2077
2078 inline long atomic_load_explicit
2079 ( volatile atomic_long* __a__, memory_order __x__ )
2080 { return _ATOMIC_LOAD_( __a__, __x__ ); }
2081
2082 inline long atomic_load( volatile atomic_long* __a__ )
2083 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
2084
2085 inline void atomic_init
2086 ( volatile atomic_long* __a__, long __m__ )
2087 { _ATOMIC_INIT_( __a__, __m__ ); }
2088
2089 inline void atomic_store_explicit
2090 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2091 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
2092
2093 inline void atomic_store
2094 ( volatile atomic_long* __a__, long __m__ )
2095 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
2096
2097 inline long atomic_exchange_explicit
2098 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2099 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
2100
2101 inline long atomic_exchange
2102 ( volatile atomic_long* __a__, long __m__ )
2103 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
2104
2105 inline bool atomic_compare_exchange_weak_explicit
2106 ( volatile atomic_long* __a__, long* __e__, long __m__,
2107   memory_order __x__, memory_order __y__ )
2108 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
2109
2110 inline bool atomic_compare_exchange_strong_explicit
2111 ( volatile atomic_long* __a__, long* __e__, long __m__,
2112   memory_order __x__, memory_order __y__ )
2113 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
2114
2115 inline bool atomic_compare_exchange_weak
2116 ( volatile atomic_long* __a__, long* __e__, long __m__ )
2117 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
2118                  memory_order_seq_cst, memory_order_seq_cst ); }
2119
2120 inline bool atomic_compare_exchange_strong
2121 ( volatile atomic_long* __a__, long* __e__, long __m__ )
2122 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
2123                  memory_order_seq_cst, memory_order_seq_cst ); }
2124
2125
2126 inline bool atomic_is_lock_free( const volatile atomic_ulong* __a__ )
2127 { return false; }
2128
2129 inline unsigned long atomic_load_explicit
2130 ( volatile atomic_ulong* __a__, memory_order __x__ )
2131 { return _ATOMIC_LOAD_( __a__, __x__ ); }
2132
2133 inline unsigned long atomic_load( volatile atomic_ulong* __a__ )
2134 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
2135
2136 inline void atomic_init
2137 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2138 { _ATOMIC_INIT_( __a__, __m__ ); }
2139
2140 inline void atomic_store_explicit
2141 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2142 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
2143
2144 inline void atomic_store
2145 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2146 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
2147
2148 inline unsigned long atomic_exchange_explicit
2149 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2150 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
2151
2152 inline unsigned long atomic_exchange
2153 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2154 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
2155
2156 inline bool atomic_compare_exchange_weak_explicit
2157 ( volatile atomic_ulong* __a__, unsigned long* __e__, unsigned long __m__,
2158   memory_order __x__, memory_order __y__ )
2159 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
2160
2161 inline bool atomic_compare_exchange_strong_explicit
2162 ( volatile atomic_ulong* __a__, unsigned long* __e__, unsigned long __m__,
2163   memory_order __x__, memory_order __y__ )
2164 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
2165
2166 inline bool atomic_compare_exchange_weak
2167 ( volatile atomic_ulong* __a__, unsigned long* __e__, unsigned long __m__ )
2168 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
2169                  memory_order_seq_cst, memory_order_seq_cst ); }
2170
2171 inline bool atomic_compare_exchange_strong
2172 ( volatile atomic_ulong* __a__, unsigned long* __e__, unsigned long __m__ )
2173 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
2174                  memory_order_seq_cst, memory_order_seq_cst ); }
2175
2176
2177 inline bool atomic_is_lock_free( const volatile atomic_llong* __a__ )
2178 { return false; }
2179
2180 inline long long atomic_load_explicit
2181 ( volatile atomic_llong* __a__, memory_order __x__ )
2182 { return _ATOMIC_LOAD_( __a__, __x__ ); }
2183
2184 inline long long atomic_load( volatile atomic_llong* __a__ )
2185 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
2186
2187 inline void atomic_init
2188 ( volatile atomic_llong* __a__, long long __m__ )
2189 { _ATOMIC_INIT_( __a__, __m__ ); }
2190
2191 inline void atomic_store_explicit
2192 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2193 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
2194
2195 inline void atomic_store
2196 ( volatile atomic_llong* __a__, long long __m__ )
2197 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
2198
2199 inline long long atomic_exchange_explicit
2200 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2201 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
2202
2203 inline long long atomic_exchange
2204 ( volatile atomic_llong* __a__, long long __m__ )
2205 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
2206
2207 inline bool atomic_compare_exchange_weak_explicit
2208 ( volatile atomic_llong* __a__, long long* __e__, long long __m__,
2209   memory_order __x__, memory_order __y__ )
2210 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
2211
2212 inline bool atomic_compare_exchange_strong_explicit
2213 ( volatile atomic_llong* __a__, long long* __e__, long long __m__,
2214   memory_order __x__, memory_order __y__ )
2215 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
2216
2217 inline bool atomic_compare_exchange_weak
2218 ( volatile atomic_llong* __a__, long long* __e__, long long __m__ )
2219 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
2220                  memory_order_seq_cst, memory_order_seq_cst ); }
2221
2222 inline bool atomic_compare_exchange_strong
2223 ( volatile atomic_llong* __a__, long long* __e__, long long __m__ )
2224 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
2225                  memory_order_seq_cst, memory_order_seq_cst ); }
2226
2227
2228 inline bool atomic_is_lock_free( const volatile atomic_ullong* __a__ )
2229 { return false; }
2230
2231 inline unsigned long long atomic_load_explicit
2232 ( volatile atomic_ullong* __a__, memory_order __x__ )
2233 { return _ATOMIC_LOAD_( __a__, __x__ ); }
2234
2235 inline unsigned long long atomic_load( volatile atomic_ullong* __a__ )
2236 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
2237
2238 inline void atomic_init
2239 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2240 { _ATOMIC_INIT_( __a__, __m__ ); }
2241
2242 inline void atomic_store_explicit
2243 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2244 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
2245
2246 inline void atomic_store
2247 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2248 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
2249
2250 inline unsigned long long atomic_exchange_explicit
2251 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2252 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
2253
2254 inline unsigned long long atomic_exchange
2255 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2256 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
2257
2258 inline bool atomic_compare_exchange_weak_explicit
2259 ( volatile atomic_ullong* __a__, unsigned long long* __e__, unsigned long long __m__,
2260   memory_order __x__, memory_order __y__ )
2261 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
2262
2263 inline bool atomic_compare_exchange_strong_explicit
2264 ( volatile atomic_ullong* __a__, unsigned long long* __e__, unsigned long long __m__,
2265   memory_order __x__, memory_order __y__ )
2266 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
2267
2268 inline bool atomic_compare_exchange_weak
2269 ( volatile atomic_ullong* __a__, unsigned long long* __e__, unsigned long long __m__ )
2270 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
2271                  memory_order_seq_cst, memory_order_seq_cst ); }
2272
2273 inline bool atomic_compare_exchange_strong
2274 ( volatile atomic_ullong* __a__, unsigned long long* __e__, unsigned long long __m__ )
2275 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
2276                  memory_order_seq_cst, memory_order_seq_cst ); }
2277
2278
2279 inline bool atomic_is_lock_free( const volatile atomic_wchar_t* __a__ )
2280 { return false; }
2281
2282 inline wchar_t atomic_load_explicit
2283 ( volatile atomic_wchar_t* __a__, memory_order __x__ )
2284 { return _ATOMIC_LOAD_( __a__, __x__ ); }
2285
2286 inline wchar_t atomic_load( volatile atomic_wchar_t* __a__ )
2287 { return atomic_load_explicit( __a__, memory_order_seq_cst ); }
2288
2289 inline void atomic_init
2290 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2291 { _ATOMIC_INIT_( __a__, __m__ ); }
2292
2293 inline void atomic_store_explicit
2294 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2295 { _ATOMIC_STORE_( __a__, __m__, __x__ ); }
2296
2297 inline void atomic_store
2298 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2299 { atomic_store_explicit( __a__, __m__, memory_order_seq_cst ); }
2300
2301 inline wchar_t atomic_exchange_explicit
2302 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2303 { return _ATOMIC_MODIFY_( __a__, =, __m__, __x__ ); }
2304
2305 inline wchar_t atomic_exchange
2306 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2307 { return atomic_exchange_explicit( __a__, __m__, memory_order_seq_cst ); }
2308
2309 inline bool atomic_compare_exchange_weak_explicit
2310 ( volatile atomic_wchar_t* __a__, wchar_t* __e__, wchar_t __m__,
2311   memory_order __x__, memory_order __y__ )
2312 { return _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ ); }
2313
2314 inline bool atomic_compare_exchange_strong_explicit
2315 ( volatile atomic_wchar_t* __a__, wchar_t* __e__, wchar_t __m__,
2316   memory_order __x__, memory_order __y__ )
2317 { return _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ ); }
2318
2319 inline bool atomic_compare_exchange_weak
2320 ( volatile atomic_wchar_t* __a__, wchar_t* __e__, wchar_t __m__ )
2321 { return atomic_compare_exchange_weak_explicit( __a__, __e__, __m__,
2322                  memory_order_seq_cst, memory_order_seq_cst ); }
2323
2324 inline bool atomic_compare_exchange_strong
2325 ( volatile atomic_wchar_t* __a__, wchar_t* __e__, wchar_t __m__ )
2326 { return atomic_compare_exchange_strong_explicit( __a__, __e__, __m__,
2327                  memory_order_seq_cst, memory_order_seq_cst ); }
2328
2329
2330 inline void* atomic_fetch_add_explicit
2331 ( volatile atomic_address* __a__, ptrdiff_t __m__, memory_order __x__ )
2332 {
2333         void* volatile* __p__ = &((__a__)->__f__);
2334         void* __r__ = (void *) model_rmwr_action((void *)__p__, __x__);
2335         model_rmw_action((void *)__p__, __x__, (uint64_t) ((char*)(*__p__) + __m__));
2336   return __r__; }
2337
2338 inline void* atomic_fetch_add
2339 ( volatile atomic_address* __a__, ptrdiff_t __m__ )
2340 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2341
2342
2343 inline void* atomic_fetch_sub_explicit
2344 ( volatile atomic_address* __a__, ptrdiff_t __m__, memory_order __x__ )
2345 {
2346         void* volatile* __p__ = &((__a__)->__f__);
2347         void* __r__ = (void *) model_rmwr_action((void *)__p__, __x__);
2348         model_rmw_action((void *)__p__, __x__, (uint64_t)((char*)(*__p__) - __m__));
2349   return __r__; }
2350
2351 inline void* atomic_fetch_sub
2352 ( volatile atomic_address* __a__, ptrdiff_t __m__ )
2353 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2354
2355 inline char atomic_fetch_add_explicit
2356 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2357 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2358
2359 inline char atomic_fetch_add
2360 ( volatile atomic_char* __a__, char __m__ )
2361 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2362
2363
2364 inline char atomic_fetch_sub_explicit
2365 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2366 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2367
2368 inline char atomic_fetch_sub
2369 ( volatile atomic_char* __a__, char __m__ )
2370 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2371
2372
2373 inline char atomic_fetch_and_explicit
2374 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2375 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2376
2377 inline char atomic_fetch_and
2378 ( volatile atomic_char* __a__, char __m__ )
2379 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2380
2381
2382 inline char atomic_fetch_or_explicit
2383 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2384 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2385
2386 inline char atomic_fetch_or
2387 ( volatile atomic_char* __a__, char __m__ )
2388 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2389
2390
2391 inline char atomic_fetch_xor_explicit
2392 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2393 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2394
2395 inline char atomic_fetch_xor
2396 ( volatile atomic_char* __a__, char __m__ )
2397 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2398
2399
2400 inline signed char atomic_fetch_add_explicit
2401 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2402 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2403
2404 inline signed char atomic_fetch_add
2405 ( volatile atomic_schar* __a__, signed char __m__ )
2406 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2407
2408
2409 inline signed char atomic_fetch_sub_explicit
2410 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2411 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2412
2413 inline signed char atomic_fetch_sub
2414 ( volatile atomic_schar* __a__, signed char __m__ )
2415 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2416
2417
2418 inline signed char atomic_fetch_and_explicit
2419 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2420 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2421
2422 inline signed char atomic_fetch_and
2423 ( volatile atomic_schar* __a__, signed char __m__ )
2424 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2425
2426
2427 inline signed char atomic_fetch_or_explicit
2428 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2429 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2430
2431 inline signed char atomic_fetch_or
2432 ( volatile atomic_schar* __a__, signed char __m__ )
2433 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2434
2435
2436 inline signed char atomic_fetch_xor_explicit
2437 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2438 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2439
2440 inline signed char atomic_fetch_xor
2441 ( volatile atomic_schar* __a__, signed char __m__ )
2442 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2443
2444
2445 inline unsigned char atomic_fetch_add_explicit
2446 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2447 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2448
2449 inline unsigned char atomic_fetch_add
2450 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2451 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2452
2453
2454 inline unsigned char atomic_fetch_sub_explicit
2455 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2456 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2457
2458 inline unsigned char atomic_fetch_sub
2459 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2460 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2461
2462
2463 inline unsigned char atomic_fetch_and_explicit
2464 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2465 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2466
2467 inline unsigned char atomic_fetch_and
2468 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2469 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2470
2471
2472 inline unsigned char atomic_fetch_or_explicit
2473 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2474 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2475
2476 inline unsigned char atomic_fetch_or
2477 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2478 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2479
2480
2481 inline unsigned char atomic_fetch_xor_explicit
2482 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2483 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2484
2485 inline unsigned char atomic_fetch_xor
2486 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2487 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2488
2489
2490 inline short atomic_fetch_add_explicit
2491 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2492 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2493
2494 inline short atomic_fetch_add
2495 ( volatile atomic_short* __a__, short __m__ )
2496 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2497
2498
2499 inline short atomic_fetch_sub_explicit
2500 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2501 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2502
2503 inline short atomic_fetch_sub
2504 ( volatile atomic_short* __a__, short __m__ )
2505 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2506
2507
2508 inline short atomic_fetch_and_explicit
2509 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2510 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2511
2512 inline short atomic_fetch_and
2513 ( volatile atomic_short* __a__, short __m__ )
2514 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2515
2516
2517 inline short atomic_fetch_or_explicit
2518 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2519 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2520
2521 inline short atomic_fetch_or
2522 ( volatile atomic_short* __a__, short __m__ )
2523 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2524
2525
2526 inline short atomic_fetch_xor_explicit
2527 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2528 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2529
2530 inline short atomic_fetch_xor
2531 ( volatile atomic_short* __a__, short __m__ )
2532 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2533
2534
2535 inline unsigned short atomic_fetch_add_explicit
2536 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2537 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2538
2539 inline unsigned short atomic_fetch_add
2540 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2541 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2542
2543
2544 inline unsigned short atomic_fetch_sub_explicit
2545 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2546 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2547
2548 inline unsigned short atomic_fetch_sub
2549 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2550 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2551
2552
2553 inline unsigned short atomic_fetch_and_explicit
2554 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2555 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2556
2557 inline unsigned short atomic_fetch_and
2558 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2559 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2560
2561
2562 inline unsigned short atomic_fetch_or_explicit
2563 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2564 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2565
2566 inline unsigned short atomic_fetch_or
2567 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2568 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2569
2570
2571 inline unsigned short atomic_fetch_xor_explicit
2572 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2573 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2574
2575 inline unsigned short atomic_fetch_xor
2576 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2577 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2578
2579
2580 inline int atomic_fetch_add_explicit
2581 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2582 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2583
2584 inline int atomic_fetch_add
2585 ( volatile atomic_int* __a__, int __m__ )
2586 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2587
2588
2589 inline int atomic_fetch_sub_explicit
2590 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2591 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2592
2593 inline int atomic_fetch_sub
2594 ( volatile atomic_int* __a__, int __m__ )
2595 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2596
2597
2598 inline int atomic_fetch_and_explicit
2599 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2600 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2601
2602 inline int atomic_fetch_and
2603 ( volatile atomic_int* __a__, int __m__ )
2604 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2605
2606
2607 inline int atomic_fetch_or_explicit
2608 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2609 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2610
2611 inline int atomic_fetch_or
2612 ( volatile atomic_int* __a__, int __m__ )
2613 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2614
2615
2616 inline int atomic_fetch_xor_explicit
2617 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2618 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2619
2620 inline int atomic_fetch_xor
2621 ( volatile atomic_int* __a__, int __m__ )
2622 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2623
2624
2625 inline unsigned int atomic_fetch_add_explicit
2626 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2627 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2628
2629 inline unsigned int atomic_fetch_add
2630 ( volatile atomic_uint* __a__, unsigned int __m__ )
2631 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2632
2633
2634 inline unsigned int atomic_fetch_sub_explicit
2635 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2636 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2637
2638 inline unsigned int atomic_fetch_sub
2639 ( volatile atomic_uint* __a__, unsigned int __m__ )
2640 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2641
2642
2643 inline unsigned int atomic_fetch_and_explicit
2644 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2645 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2646
2647 inline unsigned int atomic_fetch_and
2648 ( volatile atomic_uint* __a__, unsigned int __m__ )
2649 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2650
2651
2652 inline unsigned int atomic_fetch_or_explicit
2653 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2654 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2655
2656 inline unsigned int atomic_fetch_or
2657 ( volatile atomic_uint* __a__, unsigned int __m__ )
2658 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2659
2660
2661 inline unsigned int atomic_fetch_xor_explicit
2662 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2663 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2664
2665 inline unsigned int atomic_fetch_xor
2666 ( volatile atomic_uint* __a__, unsigned int __m__ )
2667 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2668
2669
2670 inline long atomic_fetch_add_explicit
2671 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2672 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2673
2674 inline long atomic_fetch_add
2675 ( volatile atomic_long* __a__, long __m__ )
2676 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2677
2678
2679 inline long atomic_fetch_sub_explicit
2680 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2681 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2682
2683 inline long atomic_fetch_sub
2684 ( volatile atomic_long* __a__, long __m__ )
2685 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2686
2687
2688 inline long atomic_fetch_and_explicit
2689 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2690 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2691
2692 inline long atomic_fetch_and
2693 ( volatile atomic_long* __a__, long __m__ )
2694 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2695
2696
2697 inline long atomic_fetch_or_explicit
2698 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2699 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2700
2701 inline long atomic_fetch_or
2702 ( volatile atomic_long* __a__, long __m__ )
2703 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2704
2705
2706 inline long atomic_fetch_xor_explicit
2707 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2708 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2709
2710 inline long atomic_fetch_xor
2711 ( volatile atomic_long* __a__, long __m__ )
2712 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2713
2714
2715 inline unsigned long atomic_fetch_add_explicit
2716 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2717 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2718
2719 inline unsigned long atomic_fetch_add
2720 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2721 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2722
2723
2724 inline unsigned long atomic_fetch_sub_explicit
2725 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2726 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2727
2728 inline unsigned long atomic_fetch_sub
2729 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2730 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2731
2732
2733 inline unsigned long atomic_fetch_and_explicit
2734 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2735 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2736
2737 inline unsigned long atomic_fetch_and
2738 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2739 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2740
2741
2742 inline unsigned long atomic_fetch_or_explicit
2743 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2744 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2745
2746 inline unsigned long atomic_fetch_or
2747 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2748 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2749
2750
2751 inline unsigned long atomic_fetch_xor_explicit
2752 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2753 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2754
2755 inline unsigned long atomic_fetch_xor
2756 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2757 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2758
2759
2760 inline long long atomic_fetch_add_explicit
2761 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2762 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2763
2764 inline long long atomic_fetch_add
2765 ( volatile atomic_llong* __a__, long long __m__ )
2766 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2767
2768
2769 inline long long atomic_fetch_sub_explicit
2770 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2771 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2772
2773 inline long long atomic_fetch_sub
2774 ( volatile atomic_llong* __a__, long long __m__ )
2775 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2776
2777
2778 inline long long atomic_fetch_and_explicit
2779 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2780 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2781
2782 inline long long atomic_fetch_and
2783 ( volatile atomic_llong* __a__, long long __m__ )
2784 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2785
2786
2787 inline long long atomic_fetch_or_explicit
2788 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2789 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2790
2791 inline long long atomic_fetch_or
2792 ( volatile atomic_llong* __a__, long long __m__ )
2793 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2794
2795
2796 inline long long atomic_fetch_xor_explicit
2797 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2798 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2799
2800 inline long long atomic_fetch_xor
2801 ( volatile atomic_llong* __a__, long long __m__ )
2802 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2803
2804
2805 inline unsigned long long atomic_fetch_add_explicit
2806 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2807 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2808
2809 inline unsigned long long atomic_fetch_add
2810 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2811 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2812
2813
2814 inline unsigned long long atomic_fetch_sub_explicit
2815 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2816 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2817
2818 inline unsigned long long atomic_fetch_sub
2819 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2820 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2821
2822
2823 inline unsigned long long atomic_fetch_and_explicit
2824 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2825 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2826
2827 inline unsigned long long atomic_fetch_and
2828 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2829 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2830
2831
2832 inline unsigned long long atomic_fetch_or_explicit
2833 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2834 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2835
2836 inline unsigned long long atomic_fetch_or
2837 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2838 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2839
2840
2841 inline unsigned long long atomic_fetch_xor_explicit
2842 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2843 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2844
2845 inline unsigned long long atomic_fetch_xor
2846 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2847 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2848
2849
2850 inline wchar_t atomic_fetch_add_explicit
2851 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2852 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2853
2854 inline wchar_t atomic_fetch_add
2855 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2856 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2857
2858
2859 inline wchar_t atomic_fetch_sub_explicit
2860 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2861 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2862
2863 inline wchar_t atomic_fetch_sub
2864 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2865 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2866
2867
2868 inline wchar_t atomic_fetch_and_explicit
2869 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2870 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2871
2872 inline wchar_t atomic_fetch_and
2873 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2874 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2875
2876
2877 inline wchar_t atomic_fetch_or_explicit
2878 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2879 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2880
2881 inline wchar_t atomic_fetch_or
2882 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2883 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2884
2885
2886 inline wchar_t atomic_fetch_xor_explicit
2887 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2888 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2889
2890 inline wchar_t atomic_fetch_xor
2891 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2892 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2893
2894
2895 #else
2896
2897
2898 #define atomic_is_lock_free( __a__ ) \
2899 false
2900
2901 #define atomic_load( __a__ ) \
2902 _ATOMIC_LOAD_( __a__, memory_order_seq_cst )
2903
2904 #define atomic_load_explicit( __a__, __x__ ) \
2905 _ATOMIC_LOAD_( __a__, __x__ )
2906
2907 #define atomic_init( __a__, __m__ ) \
2908 _ATOMIC_INIT_( __a__, __m__ )
2909
2910 #define atomic_store( __a__, __m__ ) \
2911 _ATOMIC_STORE_( __a__, __m__, memory_order_seq_cst )
2912
2913 #define atomic_store_explicit( __a__, __m__, __x__ ) \
2914 _ATOMIC_STORE_( __a__, __m__, __x__ )
2915
2916 #define atomic_exchange( __a__, __m__ ) \
2917 _ATOMIC_MODIFY_( __a__, =, __m__, memory_order_seq_cst )
2918
2919 #define atomic_exchange_explicit( __a__, __m__, __x__ ) \
2920 _ATOMIC_MODIFY_( __a__, =, __m__, __x__ )
2921
2922 #define atomic_compare_exchange_weak( __a__, __e__, __m__ ) \
2923 _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, memory_order_seq_cst )
2924
2925 #define atomic_compare_exchange_strong( __a__, __e__, __m__ ) \
2926 _ATOMIC_CMPSWP_( __a__, __e__, __m__, memory_order_seq_cst )
2927
2928 #define atomic_compare_exchange_weak_explicit( __a__, __e__, __m__, __x__, __y__ ) \
2929 _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ )
2930
2931 #define atomic_compare_exchange_strong_explicit( __a__, __e__, __m__, __x__, __y__ ) \
2932 _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ )
2933
2934
2935 #define atomic_fetch_add_explicit( __a__, __m__, __x__ ) \
2936 _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ )
2937
2938 #define atomic_fetch_add( __a__, __m__ ) \
2939 _ATOMIC_MODIFY_( __a__, +=, __m__, memory_order_seq_cst )
2940
2941
2942 #define atomic_fetch_sub_explicit( __a__, __m__, __x__ ) \
2943 _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ )
2944
2945 #define atomic_fetch_sub( __a__, __m__ ) \
2946 _ATOMIC_MODIFY_( __a__, -=, __m__, memory_order_seq_cst )
2947
2948
2949 #define atomic_fetch_and_explicit( __a__, __m__, __x__ ) \
2950 _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ )
2951
2952 #define atomic_fetch_and( __a__, __m__ ) \
2953 _ATOMIC_MODIFY_( __a__, &=, __m__, memory_order_seq_cst )
2954
2955
2956 #define atomic_fetch_or_explicit( __a__, __m__, __x__ ) \
2957 _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ )
2958
2959 #define atomic_fetch_or( __a__, __m__ ) \
2960 _ATOMIC_MODIFY_( __a__, |=, __m__, memory_order_seq_cst )
2961
2962
2963 #define atomic_fetch_xor_explicit( __a__, __m__, __x__ ) \
2964 _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ )
2965
2966 #define atomic_fetch_xor( __a__, __m__ ) \
2967 _ATOMIC_MODIFY_( __a__, ^=, __m__, memory_order_seq_cst )
2968
2969
2970 #endif
2971
2972
2973 #ifdef __cplusplus
2974
2975
2976 inline bool atomic_bool::is_lock_free() const volatile
2977 { return false; }
2978
2979 inline void atomic_bool::store
2980 ( bool __m__, memory_order __x__ ) volatile
2981 { atomic_store_explicit( this, __m__, __x__ ); }
2982
2983 inline bool atomic_bool::load
2984 ( memory_order __x__ ) volatile
2985 { return atomic_load_explicit( this, __x__ ); }
2986
2987 inline bool atomic_bool::exchange
2988 ( bool __m__, memory_order __x__ ) volatile
2989 { return atomic_exchange_explicit( this, __m__, __x__ ); }
2990
2991 inline bool atomic_bool::compare_exchange_weak
2992 ( bool& __e__, bool __m__,
2993   memory_order __x__, memory_order __y__ ) volatile
2994 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
2995
2996 inline bool atomic_bool::compare_exchange_strong
2997 ( bool& __e__, bool __m__,
2998   memory_order __x__, memory_order __y__ ) volatile
2999 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3000
3001 inline bool atomic_bool::compare_exchange_weak
3002 ( bool& __e__, bool __m__, memory_order __x__ ) volatile
3003 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3004       __x__ == memory_order_acq_rel ? memory_order_acquire :
3005       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3006
3007 inline bool atomic_bool::compare_exchange_strong
3008 ( bool& __e__, bool __m__, memory_order __x__ ) volatile
3009 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3010       __x__ == memory_order_acq_rel ? memory_order_acquire :
3011       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3012
3013
3014 inline bool atomic_address::is_lock_free() const volatile
3015 { return false; }
3016
3017 inline void atomic_address::store
3018 ( void* __m__, memory_order __x__ ) volatile
3019 { atomic_store_explicit( this, __m__, __x__ ); }
3020
3021 inline void* atomic_address::load
3022 ( memory_order __x__ ) volatile
3023 { return atomic_load_explicit( this, __x__ ); }
3024
3025 inline void* atomic_address::exchange
3026 ( void* __m__, memory_order __x__ ) volatile
3027 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3028
3029 inline bool atomic_address::compare_exchange_weak
3030 ( void*& __e__, void* __m__,
3031   memory_order __x__, memory_order __y__ ) volatile
3032 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3033
3034 inline bool atomic_address::compare_exchange_strong
3035 ( void*& __e__, void* __m__,
3036   memory_order __x__, memory_order __y__ ) volatile
3037 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3038
3039 inline bool atomic_address::compare_exchange_weak
3040 ( void*& __e__, void* __m__, memory_order __x__ ) volatile
3041 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3042       __x__ == memory_order_acq_rel ? memory_order_acquire :
3043       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3044
3045 inline bool atomic_address::compare_exchange_strong
3046 ( void*& __e__, void* __m__, memory_order __x__ ) volatile
3047 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3048       __x__ == memory_order_acq_rel ? memory_order_acquire :
3049       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3050
3051
3052 inline bool atomic_char::is_lock_free() const volatile
3053 { return false; }
3054
3055 inline void atomic_char::store
3056 ( char __m__, memory_order __x__ ) volatile
3057 { atomic_store_explicit( this, __m__, __x__ ); }
3058
3059 inline char atomic_char::load
3060 ( memory_order __x__ ) volatile
3061 { return atomic_load_explicit( this, __x__ ); }
3062
3063 inline char atomic_char::exchange
3064 ( char __m__, memory_order __x__ ) volatile
3065 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3066
3067 inline bool atomic_char::compare_exchange_weak
3068 ( char& __e__, char __m__,
3069   memory_order __x__, memory_order __y__ ) volatile
3070 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3071
3072 inline bool atomic_char::compare_exchange_strong
3073 ( char& __e__, char __m__,
3074   memory_order __x__, memory_order __y__ ) volatile
3075 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3076
3077 inline bool atomic_char::compare_exchange_weak
3078 ( char& __e__, char __m__, memory_order __x__ ) volatile
3079 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3080       __x__ == memory_order_acq_rel ? memory_order_acquire :
3081       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3082
3083 inline bool atomic_char::compare_exchange_strong
3084 ( char& __e__, char __m__, memory_order __x__ ) volatile
3085 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3086       __x__ == memory_order_acq_rel ? memory_order_acquire :
3087       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3088
3089
3090 inline bool atomic_schar::is_lock_free() const volatile
3091 { return false; }
3092
3093 inline void atomic_schar::store
3094 ( signed char __m__, memory_order __x__ ) volatile
3095 { atomic_store_explicit( this, __m__, __x__ ); }
3096
3097 inline signed char atomic_schar::load
3098 ( memory_order __x__ ) volatile
3099 { return atomic_load_explicit( this, __x__ ); }
3100
3101 inline signed char atomic_schar::exchange
3102 ( signed char __m__, memory_order __x__ ) volatile
3103 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3104
3105 inline bool atomic_schar::compare_exchange_weak
3106 ( signed char& __e__, signed char __m__,
3107   memory_order __x__, memory_order __y__ ) volatile
3108 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3109
3110 inline bool atomic_schar::compare_exchange_strong
3111 ( signed char& __e__, signed char __m__,
3112   memory_order __x__, memory_order __y__ ) volatile
3113 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3114
3115 inline bool atomic_schar::compare_exchange_weak
3116 ( signed char& __e__, signed char __m__, memory_order __x__ ) volatile
3117 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3118       __x__ == memory_order_acq_rel ? memory_order_acquire :
3119       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3120
3121 inline bool atomic_schar::compare_exchange_strong
3122 ( signed char& __e__, signed char __m__, memory_order __x__ ) volatile
3123 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3124       __x__ == memory_order_acq_rel ? memory_order_acquire :
3125       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3126
3127
3128 inline bool atomic_uchar::is_lock_free() const volatile
3129 { return false; }
3130
3131 inline void atomic_uchar::store
3132 ( unsigned char __m__, memory_order __x__ ) volatile
3133 { atomic_store_explicit( this, __m__, __x__ ); }
3134
3135 inline unsigned char atomic_uchar::load
3136 ( memory_order __x__ ) volatile
3137 { return atomic_load_explicit( this, __x__ ); }
3138
3139 inline unsigned char atomic_uchar::exchange
3140 ( unsigned char __m__, memory_order __x__ ) volatile
3141 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3142
3143 inline bool atomic_uchar::compare_exchange_weak
3144 ( unsigned char& __e__, unsigned char __m__,
3145   memory_order __x__, memory_order __y__ ) volatile
3146 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3147
3148 inline bool atomic_uchar::compare_exchange_strong
3149 ( unsigned char& __e__, unsigned char __m__,
3150   memory_order __x__, memory_order __y__ ) volatile
3151 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3152
3153 inline bool atomic_uchar::compare_exchange_weak
3154 ( unsigned char& __e__, unsigned char __m__, memory_order __x__ ) volatile
3155 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3156       __x__ == memory_order_acq_rel ? memory_order_acquire :
3157       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3158
3159 inline bool atomic_uchar::compare_exchange_strong
3160 ( unsigned char& __e__, unsigned char __m__, memory_order __x__ ) volatile
3161 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3162       __x__ == memory_order_acq_rel ? memory_order_acquire :
3163       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3164
3165
3166 inline bool atomic_short::is_lock_free() const volatile
3167 { return false; }
3168
3169 inline void atomic_short::store
3170 ( short __m__, memory_order __x__ ) volatile
3171 { atomic_store_explicit( this, __m__, __x__ ); }
3172
3173 inline short atomic_short::load
3174 ( memory_order __x__ ) volatile
3175 { return atomic_load_explicit( this, __x__ ); }
3176
3177 inline short atomic_short::exchange
3178 ( short __m__, memory_order __x__ ) volatile
3179 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3180
3181 inline bool atomic_short::compare_exchange_weak
3182 ( short& __e__, short __m__,
3183   memory_order __x__, memory_order __y__ ) volatile
3184 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3185
3186 inline bool atomic_short::compare_exchange_strong
3187 ( short& __e__, short __m__,
3188   memory_order __x__, memory_order __y__ ) volatile
3189 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3190
3191 inline bool atomic_short::compare_exchange_weak
3192 ( short& __e__, short __m__, memory_order __x__ ) volatile
3193 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3194       __x__ == memory_order_acq_rel ? memory_order_acquire :
3195       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3196
3197 inline bool atomic_short::compare_exchange_strong
3198 ( short& __e__, short __m__, memory_order __x__ ) volatile
3199 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3200       __x__ == memory_order_acq_rel ? memory_order_acquire :
3201       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3202
3203
3204 inline bool atomic_ushort::is_lock_free() const volatile
3205 { return false; }
3206
3207 inline void atomic_ushort::store
3208 ( unsigned short __m__, memory_order __x__ ) volatile
3209 { atomic_store_explicit( this, __m__, __x__ ); }
3210
3211 inline unsigned short atomic_ushort::load
3212 ( memory_order __x__ ) volatile
3213 { return atomic_load_explicit( this, __x__ ); }
3214
3215 inline unsigned short atomic_ushort::exchange
3216 ( unsigned short __m__, memory_order __x__ ) volatile
3217 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3218
3219 inline bool atomic_ushort::compare_exchange_weak
3220 ( unsigned short& __e__, unsigned short __m__,
3221   memory_order __x__, memory_order __y__ ) volatile
3222 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3223
3224 inline bool atomic_ushort::compare_exchange_strong
3225 ( unsigned short& __e__, unsigned short __m__,
3226   memory_order __x__, memory_order __y__ ) volatile
3227 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3228
3229 inline bool atomic_ushort::compare_exchange_weak
3230 ( unsigned short& __e__, unsigned short __m__, memory_order __x__ ) volatile
3231 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3232       __x__ == memory_order_acq_rel ? memory_order_acquire :
3233       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3234
3235 inline bool atomic_ushort::compare_exchange_strong
3236 ( unsigned short& __e__, unsigned short __m__, memory_order __x__ ) volatile
3237 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3238       __x__ == memory_order_acq_rel ? memory_order_acquire :
3239       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3240
3241
3242 inline bool atomic_int::is_lock_free() const volatile
3243 { return false; }
3244
3245 inline void atomic_int::store
3246 ( int __m__, memory_order __x__ ) volatile
3247 { atomic_store_explicit( this, __m__, __x__ ); }
3248
3249 inline int atomic_int::load
3250 ( memory_order __x__ ) volatile
3251 { return atomic_load_explicit( this, __x__ ); }
3252
3253 inline int atomic_int::exchange
3254 ( int __m__, memory_order __x__ ) volatile
3255 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3256
3257 inline bool atomic_int::compare_exchange_weak
3258 ( int& __e__, int __m__,
3259   memory_order __x__, memory_order __y__ ) volatile
3260 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3261
3262 inline bool atomic_int::compare_exchange_strong
3263 ( int& __e__, int __m__,
3264   memory_order __x__, memory_order __y__ ) volatile
3265 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3266
3267 inline bool atomic_int::compare_exchange_weak
3268 ( int& __e__, int __m__, memory_order __x__ ) volatile
3269 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3270       __x__ == memory_order_acq_rel ? memory_order_acquire :
3271       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3272
3273 inline bool atomic_int::compare_exchange_strong
3274 ( int& __e__, int __m__, memory_order __x__ ) volatile
3275 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3276       __x__ == memory_order_acq_rel ? memory_order_acquire :
3277       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3278
3279
3280 inline bool atomic_uint::is_lock_free() const volatile
3281 { return false; }
3282
3283 inline void atomic_uint::store
3284 ( unsigned int __m__, memory_order __x__ ) volatile
3285 { atomic_store_explicit( this, __m__, __x__ ); }
3286
3287 inline unsigned int atomic_uint::load
3288 ( memory_order __x__ ) volatile
3289 { return atomic_load_explicit( this, __x__ ); }
3290
3291 inline unsigned int atomic_uint::exchange
3292 ( unsigned int __m__, memory_order __x__ ) volatile
3293 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3294
3295 inline bool atomic_uint::compare_exchange_weak
3296 ( unsigned int& __e__, unsigned int __m__,
3297   memory_order __x__, memory_order __y__ ) volatile
3298 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3299
3300 inline bool atomic_uint::compare_exchange_strong
3301 ( unsigned int& __e__, unsigned int __m__,
3302   memory_order __x__, memory_order __y__ ) volatile
3303 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3304
3305 inline bool atomic_uint::compare_exchange_weak
3306 ( unsigned int& __e__, unsigned int __m__, memory_order __x__ ) volatile
3307 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3308       __x__ == memory_order_acq_rel ? memory_order_acquire :
3309       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3310
3311 inline bool atomic_uint::compare_exchange_strong
3312 ( unsigned int& __e__, unsigned int __m__, memory_order __x__ ) volatile
3313 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3314       __x__ == memory_order_acq_rel ? memory_order_acquire :
3315       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3316
3317
3318 inline bool atomic_long::is_lock_free() const volatile
3319 { return false; }
3320
3321 inline void atomic_long::store
3322 ( long __m__, memory_order __x__ ) volatile
3323 { atomic_store_explicit( this, __m__, __x__ ); }
3324
3325 inline long atomic_long::load
3326 ( memory_order __x__ ) volatile
3327 { return atomic_load_explicit( this, __x__ ); }
3328
3329 inline long atomic_long::exchange
3330 ( long __m__, memory_order __x__ ) volatile
3331 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3332
3333 inline bool atomic_long::compare_exchange_weak
3334 ( long& __e__, long __m__,
3335   memory_order __x__, memory_order __y__ ) volatile
3336 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3337
3338 inline bool atomic_long::compare_exchange_strong
3339 ( long& __e__, long __m__,
3340   memory_order __x__, memory_order __y__ ) volatile
3341 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3342
3343 inline bool atomic_long::compare_exchange_weak
3344 ( long& __e__, long __m__, memory_order __x__ ) volatile
3345 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3346       __x__ == memory_order_acq_rel ? memory_order_acquire :
3347       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3348
3349 inline bool atomic_long::compare_exchange_strong
3350 ( long& __e__, long __m__, memory_order __x__ ) volatile
3351 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3352       __x__ == memory_order_acq_rel ? memory_order_acquire :
3353       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3354
3355
3356 inline bool atomic_ulong::is_lock_free() const volatile
3357 { return false; }
3358
3359 inline void atomic_ulong::store
3360 ( unsigned long __m__, memory_order __x__ ) volatile
3361 { atomic_store_explicit( this, __m__, __x__ ); }
3362
3363 inline unsigned long atomic_ulong::load
3364 ( memory_order __x__ ) volatile
3365 { return atomic_load_explicit( this, __x__ ); }
3366
3367 inline unsigned long atomic_ulong::exchange
3368 ( unsigned long __m__, memory_order __x__ ) volatile
3369 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3370
3371 inline bool atomic_ulong::compare_exchange_weak
3372 ( unsigned long& __e__, unsigned long __m__,
3373   memory_order __x__, memory_order __y__ ) volatile
3374 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3375
3376 inline bool atomic_ulong::compare_exchange_strong
3377 ( unsigned long& __e__, unsigned long __m__,
3378   memory_order __x__, memory_order __y__ ) volatile
3379 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3380
3381 inline bool atomic_ulong::compare_exchange_weak
3382 ( unsigned long& __e__, unsigned long __m__, memory_order __x__ ) volatile
3383 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3384       __x__ == memory_order_acq_rel ? memory_order_acquire :
3385       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3386
3387 inline bool atomic_ulong::compare_exchange_strong
3388 ( unsigned long& __e__, unsigned long __m__, memory_order __x__ ) volatile
3389 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3390       __x__ == memory_order_acq_rel ? memory_order_acquire :
3391       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3392
3393
3394 inline bool atomic_llong::is_lock_free() const volatile
3395 { return false; }
3396
3397 inline void atomic_llong::store
3398 ( long long __m__, memory_order __x__ ) volatile
3399 { atomic_store_explicit( this, __m__, __x__ ); }
3400
3401 inline long long atomic_llong::load
3402 ( memory_order __x__ ) volatile
3403 { return atomic_load_explicit( this, __x__ ); }
3404
3405 inline long long atomic_llong::exchange
3406 ( long long __m__, memory_order __x__ ) volatile
3407 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3408
3409 inline bool atomic_llong::compare_exchange_weak
3410 ( long long& __e__, long long __m__,
3411   memory_order __x__, memory_order __y__ ) volatile
3412 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3413
3414 inline bool atomic_llong::compare_exchange_strong
3415 ( long long& __e__, long long __m__,
3416   memory_order __x__, memory_order __y__ ) volatile
3417 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3418
3419 inline bool atomic_llong::compare_exchange_weak
3420 ( long long& __e__, long long __m__, memory_order __x__ ) volatile
3421 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3422       __x__ == memory_order_acq_rel ? memory_order_acquire :
3423       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3424
3425 inline bool atomic_llong::compare_exchange_strong
3426 ( long long& __e__, long long __m__, memory_order __x__ ) volatile
3427 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3428       __x__ == memory_order_acq_rel ? memory_order_acquire :
3429       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3430
3431
3432 inline bool atomic_ullong::is_lock_free() const volatile
3433 { return false; }
3434
3435 inline void atomic_ullong::store
3436 ( unsigned long long __m__, memory_order __x__ ) volatile
3437 { atomic_store_explicit( this, __m__, __x__ ); }
3438
3439 inline unsigned long long atomic_ullong::load
3440 ( memory_order __x__ ) volatile
3441 { return atomic_load_explicit( this, __x__ ); }
3442
3443 inline unsigned long long atomic_ullong::exchange
3444 ( unsigned long long __m__, memory_order __x__ ) volatile
3445 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3446
3447 inline bool atomic_ullong::compare_exchange_weak
3448 ( unsigned long long& __e__, unsigned long long __m__,
3449   memory_order __x__, memory_order __y__ ) volatile
3450 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3451
3452 inline bool atomic_ullong::compare_exchange_strong
3453 ( unsigned long long& __e__, unsigned long long __m__,
3454   memory_order __x__, memory_order __y__ ) volatile
3455 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3456
3457 inline bool atomic_ullong::compare_exchange_weak
3458 ( unsigned long long& __e__, unsigned long long __m__, memory_order __x__ ) volatile
3459 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3460       __x__ == memory_order_acq_rel ? memory_order_acquire :
3461       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3462
3463 inline bool atomic_ullong::compare_exchange_strong
3464 ( unsigned long long& __e__, unsigned long long __m__, memory_order __x__ ) volatile
3465 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3466       __x__ == memory_order_acq_rel ? memory_order_acquire :
3467       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3468
3469
3470 inline bool atomic_wchar_t::is_lock_free() const volatile
3471 { return false; }
3472
3473 inline void atomic_wchar_t::store
3474 ( wchar_t __m__, memory_order __x__ ) volatile
3475 { atomic_store_explicit( this, __m__, __x__ ); }
3476
3477 inline wchar_t atomic_wchar_t::load
3478 ( memory_order __x__ ) volatile
3479 { return atomic_load_explicit( this, __x__ ); }
3480
3481 inline wchar_t atomic_wchar_t::exchange
3482 ( wchar_t __m__, memory_order __x__ ) volatile
3483 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3484
3485 inline bool atomic_wchar_t::compare_exchange_weak
3486 ( wchar_t& __e__, wchar_t __m__,
3487   memory_order __x__, memory_order __y__ ) volatile
3488 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3489
3490 inline bool atomic_wchar_t::compare_exchange_strong
3491 ( wchar_t& __e__, wchar_t __m__,
3492   memory_order __x__, memory_order __y__ ) volatile
3493 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3494
3495 inline bool atomic_wchar_t::compare_exchange_weak
3496 ( wchar_t& __e__, wchar_t __m__, memory_order __x__ ) volatile
3497 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3498       __x__ == memory_order_acq_rel ? memory_order_acquire :
3499       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3500
3501 inline bool atomic_wchar_t::compare_exchange_strong
3502 ( wchar_t& __e__, wchar_t __m__, memory_order __x__ ) volatile
3503 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3504       __x__ == memory_order_acq_rel ? memory_order_acquire :
3505       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3506
3507
3508 template< typename T >
3509 inline bool atomic<T>::is_lock_free() const volatile
3510 { return false; }
3511
3512 template< typename T >
3513 inline void atomic<T>::store( T __v__, memory_order __x__ ) volatile
3514 { _ATOMIC_STORE_( this, __v__, __x__ ); }
3515
3516 template< typename T >
3517 inline T atomic<T>::load( memory_order __x__ ) volatile
3518 { return _ATOMIC_LOAD_( this, __x__ ); }
3519
3520 template< typename T >
3521 inline T atomic<T>::exchange( T __v__, memory_order __x__ ) volatile
3522 { return _ATOMIC_MODIFY_( this, =, __v__, __x__ ); }
3523
3524 template< typename T >
3525 inline bool atomic<T>::compare_exchange_weak
3526 ( T& __r__, T __v__, memory_order __x__, memory_order __y__ ) volatile
3527 { return _ATOMIC_CMPSWP_WEAK_( this, &__r__, __v__, __x__ ); }
3528
3529 template< typename T >
3530 inline bool atomic<T>::compare_exchange_strong
3531 ( T& __r__, T __v__, memory_order __x__, memory_order __y__ ) volatile
3532 { return _ATOMIC_CMPSWP_( this, &__r__, __v__, __x__ ); }
3533
3534 template< typename T >
3535 inline bool atomic<T>::compare_exchange_weak
3536 ( T& __r__, T __v__, memory_order __x__ ) volatile
3537 { return compare_exchange_weak( __r__, __v__, __x__,
3538       __x__ == memory_order_acq_rel ? memory_order_acquire :
3539       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3540
3541 template< typename T >
3542 inline bool atomic<T>::compare_exchange_strong
3543 ( T& __r__, T __v__, memory_order __x__ ) volatile
3544 { return compare_exchange_strong( __r__, __v__, __x__,
3545       __x__ == memory_order_acq_rel ? memory_order_acquire :
3546       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3547
3548
3549 inline void* atomic_address::fetch_add
3550 ( ptrdiff_t __m__, memory_order __x__ ) volatile
3551 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3552
3553 inline void* atomic_address::fetch_sub
3554 ( ptrdiff_t __m__, memory_order __x__ ) volatile
3555 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3556
3557
3558 inline char atomic_char::fetch_add
3559 ( char __m__, memory_order __x__ ) volatile
3560 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3561
3562
3563 inline char atomic_char::fetch_sub
3564 ( char __m__, memory_order __x__ ) volatile
3565 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3566
3567
3568 inline char atomic_char::fetch_and
3569 ( char __m__, memory_order __x__ ) volatile
3570 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3571
3572
3573 inline char atomic_char::fetch_or
3574 ( char __m__, memory_order __x__ ) volatile
3575 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3576
3577
3578 inline char atomic_char::fetch_xor
3579 ( char __m__, memory_order __x__ ) volatile
3580 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3581
3582
3583 inline signed char atomic_schar::fetch_add
3584 ( signed char __m__, memory_order __x__ ) volatile
3585 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3586
3587
3588 inline signed char atomic_schar::fetch_sub
3589 ( signed char __m__, memory_order __x__ ) volatile
3590 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3591
3592
3593 inline signed char atomic_schar::fetch_and
3594 ( signed char __m__, memory_order __x__ ) volatile
3595 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3596
3597
3598 inline signed char atomic_schar::fetch_or
3599 ( signed char __m__, memory_order __x__ ) volatile
3600 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3601
3602
3603 inline signed char atomic_schar::fetch_xor
3604 ( signed char __m__, memory_order __x__ ) volatile
3605 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3606
3607
3608 inline unsigned char atomic_uchar::fetch_add
3609 ( unsigned char __m__, memory_order __x__ ) volatile
3610 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3611
3612
3613 inline unsigned char atomic_uchar::fetch_sub
3614 ( unsigned char __m__, memory_order __x__ ) volatile
3615 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3616
3617
3618 inline unsigned char atomic_uchar::fetch_and
3619 ( unsigned char __m__, memory_order __x__ ) volatile
3620 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3621
3622
3623 inline unsigned char atomic_uchar::fetch_or
3624 ( unsigned char __m__, memory_order __x__ ) volatile
3625 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3626
3627
3628 inline unsigned char atomic_uchar::fetch_xor
3629 ( unsigned char __m__, memory_order __x__ ) volatile
3630 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3631
3632
3633 inline short atomic_short::fetch_add
3634 ( short __m__, memory_order __x__ ) volatile
3635 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3636
3637
3638 inline short atomic_short::fetch_sub
3639 ( short __m__, memory_order __x__ ) volatile
3640 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3641
3642
3643 inline short atomic_short::fetch_and
3644 ( short __m__, memory_order __x__ ) volatile
3645 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3646
3647
3648 inline short atomic_short::fetch_or
3649 ( short __m__, memory_order __x__ ) volatile
3650 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3651
3652
3653 inline short atomic_short::fetch_xor
3654 ( short __m__, memory_order __x__ ) volatile
3655 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3656
3657
3658 inline unsigned short atomic_ushort::fetch_add
3659 ( unsigned short __m__, memory_order __x__ ) volatile
3660 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3661
3662
3663 inline unsigned short atomic_ushort::fetch_sub
3664 ( unsigned short __m__, memory_order __x__ ) volatile
3665 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3666
3667
3668 inline unsigned short atomic_ushort::fetch_and
3669 ( unsigned short __m__, memory_order __x__ ) volatile
3670 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3671
3672
3673 inline unsigned short atomic_ushort::fetch_or
3674 ( unsigned short __m__, memory_order __x__ ) volatile
3675 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3676
3677
3678 inline unsigned short atomic_ushort::fetch_xor
3679 ( unsigned short __m__, memory_order __x__ ) volatile
3680 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3681
3682
3683 inline int atomic_int::fetch_add
3684 ( int __m__, memory_order __x__ ) volatile
3685 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3686
3687
3688 inline int atomic_int::fetch_sub
3689 ( int __m__, memory_order __x__ ) volatile
3690 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3691
3692
3693 inline int atomic_int::fetch_and
3694 ( int __m__, memory_order __x__ ) volatile
3695 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3696
3697
3698 inline int atomic_int::fetch_or
3699 ( int __m__, memory_order __x__ ) volatile
3700 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3701
3702
3703 inline int atomic_int::fetch_xor
3704 ( int __m__, memory_order __x__ ) volatile
3705 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3706
3707
3708 inline unsigned int atomic_uint::fetch_add
3709 ( unsigned int __m__, memory_order __x__ ) volatile
3710 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3711
3712
3713 inline unsigned int atomic_uint::fetch_sub
3714 ( unsigned int __m__, memory_order __x__ ) volatile
3715 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3716
3717
3718 inline unsigned int atomic_uint::fetch_and
3719 ( unsigned int __m__, memory_order __x__ ) volatile
3720 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3721
3722
3723 inline unsigned int atomic_uint::fetch_or
3724 ( unsigned int __m__, memory_order __x__ ) volatile
3725 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3726
3727
3728 inline unsigned int atomic_uint::fetch_xor
3729 ( unsigned int __m__, memory_order __x__ ) volatile
3730 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3731
3732
3733 inline long atomic_long::fetch_add
3734 ( long __m__, memory_order __x__ ) volatile
3735 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3736
3737
3738 inline long atomic_long::fetch_sub
3739 ( long __m__, memory_order __x__ ) volatile
3740 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3741
3742
3743 inline long atomic_long::fetch_and
3744 ( long __m__, memory_order __x__ ) volatile
3745 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3746
3747
3748 inline long atomic_long::fetch_or
3749 ( long __m__, memory_order __x__ ) volatile
3750 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3751
3752
3753 inline long atomic_long::fetch_xor
3754 ( long __m__, memory_order __x__ ) volatile
3755 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3756
3757
3758 inline unsigned long atomic_ulong::fetch_add
3759 ( unsigned long __m__, memory_order __x__ ) volatile
3760 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3761
3762
3763 inline unsigned long atomic_ulong::fetch_sub
3764 ( unsigned long __m__, memory_order __x__ ) volatile
3765 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3766
3767
3768 inline unsigned long atomic_ulong::fetch_and
3769 ( unsigned long __m__, memory_order __x__ ) volatile
3770 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3771
3772
3773 inline unsigned long atomic_ulong::fetch_or
3774 ( unsigned long __m__, memory_order __x__ ) volatile
3775 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3776
3777
3778 inline unsigned long atomic_ulong::fetch_xor
3779 ( unsigned long __m__, memory_order __x__ ) volatile
3780 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3781
3782
3783 inline long long atomic_llong::fetch_add
3784 ( long long __m__, memory_order __x__ ) volatile
3785 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3786
3787
3788 inline long long atomic_llong::fetch_sub
3789 ( long long __m__, memory_order __x__ ) volatile
3790 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3791
3792
3793 inline long long atomic_llong::fetch_and
3794 ( long long __m__, memory_order __x__ ) volatile
3795 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3796
3797
3798 inline long long atomic_llong::fetch_or
3799 ( long long __m__, memory_order __x__ ) volatile
3800 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3801
3802
3803 inline long long atomic_llong::fetch_xor
3804 ( long long __m__, memory_order __x__ ) volatile
3805 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3806
3807
3808 inline unsigned long long atomic_ullong::fetch_add
3809 ( unsigned long long __m__, memory_order __x__ ) volatile
3810 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3811
3812
3813 inline unsigned long long atomic_ullong::fetch_sub
3814 ( unsigned long long __m__, memory_order __x__ ) volatile
3815 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3816
3817
3818 inline unsigned long long atomic_ullong::fetch_and
3819 ( unsigned long long __m__, memory_order __x__ ) volatile
3820 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3821
3822
3823 inline unsigned long long atomic_ullong::fetch_or
3824 ( unsigned long long __m__, memory_order __x__ ) volatile
3825 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3826
3827
3828 inline unsigned long long atomic_ullong::fetch_xor
3829 ( unsigned long long __m__, memory_order __x__ ) volatile
3830 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3831
3832
3833 inline wchar_t atomic_wchar_t::fetch_add
3834 ( wchar_t __m__, memory_order __x__ ) volatile
3835 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3836
3837
3838 inline wchar_t atomic_wchar_t::fetch_sub
3839 ( wchar_t __m__, memory_order __x__ ) volatile
3840 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3841
3842
3843 inline wchar_t atomic_wchar_t::fetch_and
3844 ( wchar_t __m__, memory_order __x__ ) volatile
3845 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3846
3847
3848 inline wchar_t atomic_wchar_t::fetch_or
3849 ( wchar_t __m__, memory_order __x__ ) volatile
3850 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3851
3852
3853 inline wchar_t atomic_wchar_t::fetch_xor
3854 ( wchar_t __m__, memory_order __x__ ) volatile
3855 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3856
3857
3858 template< typename T >
3859 T* atomic<T*>::load( memory_order __x__ ) volatile
3860 { return static_cast<T*>( atomic_address::load( __x__ ) ); }
3861
3862 template< typename T >
3863 T* atomic<T*>::exchange( T* __v__, memory_order __x__ ) volatile
3864 { return static_cast<T*>( atomic_address::exchange( __v__, __x__ ) ); }
3865
3866 template< typename T >
3867 bool atomic<T*>::compare_exchange_weak
3868 ( T*& __r__, T* __v__, memory_order __x__, memory_order __y__) volatile
3869 { return atomic_address::compare_exchange_weak( *reinterpret_cast<void**>( &__r__ ),
3870                static_cast<void*>( __v__ ), __x__, __y__ ); }
3871 //{ return _ATOMIC_CMPSWP_WEAK_( this, &__r__, __v__, __x__ ); }
3872
3873 template< typename T >
3874 bool atomic<T*>::compare_exchange_strong
3875 ( T*& __r__, T* __v__, memory_order __x__, memory_order __y__) volatile
3876 { return atomic_address::compare_exchange_strong( *reinterpret_cast<void**>( &__r__ ),
3877                static_cast<void*>( __v__ ), __x__, __y__ ); }
3878 //{ return _ATOMIC_CMPSWP_( this, &__r__, __v__, __x__ ); }
3879
3880 template< typename T >
3881 bool atomic<T*>::compare_exchange_weak
3882 ( T*& __r__, T* __v__, memory_order __x__ ) volatile
3883 { return compare_exchange_weak( __r__, __v__, __x__,
3884       __x__ == memory_order_acq_rel ? memory_order_acquire :
3885       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3886
3887 template< typename T >
3888 bool atomic<T*>::compare_exchange_strong
3889 ( T*& __r__, T* __v__, memory_order __x__ ) volatile
3890 { return compare_exchange_strong( __r__, __v__, __x__,
3891       __x__ == memory_order_acq_rel ? memory_order_acquire :
3892       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3893
3894 template< typename T >
3895 T* atomic<T*>::fetch_add( ptrdiff_t __v__, memory_order __x__ ) volatile
3896 { return atomic_fetch_add_explicit( this, sizeof(T) * __v__, __x__ ); }
3897
3898 template< typename T >
3899 T* atomic<T*>::fetch_sub( ptrdiff_t __v__, memory_order __x__ ) volatile
3900 { return atomic_fetch_sub_explicit( this, sizeof(T) * __v__, __x__ ); }
3901
3902
3903 #endif
3904
3905 #ifdef __cplusplus
3906 extern "C" {
3907 #endif
3908 static inline void atomic_thread_fence(memory_order order)
3909 { _ATOMIC_FENCE_(order); }
3910
3911 /** @todo Do we want to try to support a user's signal-handler? */
3912 static inline void atomic_signal_fence(memory_order order)
3913 { /* No-op? */ }
3914 #ifdef __cplusplus
3915 }
3916 #endif
3917
3918
3919 #ifdef __cplusplus
3920 } // namespace std
3921 #endif
3922
3923 #endif /* __IMPATOMIC_H__ */