Fix snapshot code
[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         volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__);
2334         __typeof__((__a__)->__f__) __old__=(__typeof__((__a__)->__f__)) model_rmwr_action((void *)__p__, __x__);
2335         __typeof__((__a__)->__f__) __copy__= __old__;
2336         __copy__ = (void *) (((char *)__copy__) + __m__);
2337         model_rmw_action((void *)__p__, __x__, (uint64_t) __copy__);
2338         return __old__;
2339 }
2340
2341  inline void* atomic_fetch_add
2342 ( volatile atomic_address* __a__, ptrdiff_t __m__ )
2343 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2344
2345
2346 inline void* atomic_fetch_sub_explicit
2347 ( volatile atomic_address* __a__, ptrdiff_t __m__, memory_order __x__ )
2348 {       volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__);
2349         __typeof__((__a__)->__f__) __old__=(__typeof__((__a__)->__f__)) model_rmwr_action((void *)__p__, __x__);
2350         __typeof__((__a__)->__f__) __copy__= __old__;
2351         __copy__ = (void *) (((char *)__copy__) - __m__);
2352         model_rmw_action((void *)__p__, __x__, (uint64_t) __copy__);
2353         return __old__;
2354 }
2355
2356 inline void* atomic_fetch_sub
2357 ( volatile atomic_address* __a__, ptrdiff_t __m__ )
2358 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2359
2360 inline char atomic_fetch_add_explicit
2361 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2362 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2363
2364 inline char atomic_fetch_add
2365 ( volatile atomic_char* __a__, char __m__ )
2366 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2367
2368
2369 inline char atomic_fetch_sub_explicit
2370 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2371 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2372
2373 inline char atomic_fetch_sub
2374 ( volatile atomic_char* __a__, char __m__ )
2375 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2376
2377
2378 inline char atomic_fetch_and_explicit
2379 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2380 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2381
2382 inline char atomic_fetch_and
2383 ( volatile atomic_char* __a__, char __m__ )
2384 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2385
2386
2387 inline char atomic_fetch_or_explicit
2388 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2389 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2390
2391 inline char atomic_fetch_or
2392 ( volatile atomic_char* __a__, char __m__ )
2393 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2394
2395
2396 inline char atomic_fetch_xor_explicit
2397 ( volatile atomic_char* __a__, char __m__, memory_order __x__ )
2398 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2399
2400 inline char atomic_fetch_xor
2401 ( volatile atomic_char* __a__, char __m__ )
2402 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2403
2404
2405 inline signed char atomic_fetch_add_explicit
2406 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2407 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2408
2409 inline signed char atomic_fetch_add
2410 ( volatile atomic_schar* __a__, signed char __m__ )
2411 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2412
2413
2414 inline signed char atomic_fetch_sub_explicit
2415 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2416 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2417
2418 inline signed char atomic_fetch_sub
2419 ( volatile atomic_schar* __a__, signed char __m__ )
2420 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2421
2422
2423 inline signed char atomic_fetch_and_explicit
2424 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2425 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2426
2427 inline signed char atomic_fetch_and
2428 ( volatile atomic_schar* __a__, signed char __m__ )
2429 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2430
2431
2432 inline signed char atomic_fetch_or_explicit
2433 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2434 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2435
2436 inline signed char atomic_fetch_or
2437 ( volatile atomic_schar* __a__, signed char __m__ )
2438 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2439
2440
2441 inline signed char atomic_fetch_xor_explicit
2442 ( volatile atomic_schar* __a__, signed char __m__, memory_order __x__ )
2443 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2444
2445 inline signed char atomic_fetch_xor
2446 ( volatile atomic_schar* __a__, signed char __m__ )
2447 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2448
2449
2450 inline unsigned char atomic_fetch_add_explicit
2451 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2452 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2453
2454 inline unsigned char atomic_fetch_add
2455 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2456 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2457
2458
2459 inline unsigned char atomic_fetch_sub_explicit
2460 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2461 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2462
2463 inline unsigned char atomic_fetch_sub
2464 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2465 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2466
2467
2468 inline unsigned char atomic_fetch_and_explicit
2469 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2470 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2471
2472 inline unsigned char atomic_fetch_and
2473 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2474 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2475
2476
2477 inline unsigned char atomic_fetch_or_explicit
2478 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2479 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2480
2481 inline unsigned char atomic_fetch_or
2482 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2483 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2484
2485
2486 inline unsigned char atomic_fetch_xor_explicit
2487 ( volatile atomic_uchar* __a__, unsigned char __m__, memory_order __x__ )
2488 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2489
2490 inline unsigned char atomic_fetch_xor
2491 ( volatile atomic_uchar* __a__, unsigned char __m__ )
2492 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2493
2494
2495 inline short atomic_fetch_add_explicit
2496 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2497 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2498
2499 inline short atomic_fetch_add
2500 ( volatile atomic_short* __a__, short __m__ )
2501 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2502
2503
2504 inline short atomic_fetch_sub_explicit
2505 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2506 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2507
2508 inline short atomic_fetch_sub
2509 ( volatile atomic_short* __a__, short __m__ )
2510 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2511
2512
2513 inline short atomic_fetch_and_explicit
2514 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2515 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2516
2517 inline short atomic_fetch_and
2518 ( volatile atomic_short* __a__, short __m__ )
2519 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2520
2521
2522 inline short atomic_fetch_or_explicit
2523 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2524 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2525
2526 inline short atomic_fetch_or
2527 ( volatile atomic_short* __a__, short __m__ )
2528 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2529
2530
2531 inline short atomic_fetch_xor_explicit
2532 ( volatile atomic_short* __a__, short __m__, memory_order __x__ )
2533 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2534
2535 inline short atomic_fetch_xor
2536 ( volatile atomic_short* __a__, short __m__ )
2537 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2538
2539
2540 inline unsigned short atomic_fetch_add_explicit
2541 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2542 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2543
2544 inline unsigned short atomic_fetch_add
2545 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2546 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2547
2548
2549 inline unsigned short atomic_fetch_sub_explicit
2550 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2551 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2552
2553 inline unsigned short atomic_fetch_sub
2554 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2555 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2556
2557
2558 inline unsigned short atomic_fetch_and_explicit
2559 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2560 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2561
2562 inline unsigned short atomic_fetch_and
2563 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2564 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2565
2566
2567 inline unsigned short atomic_fetch_or_explicit
2568 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2569 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2570
2571 inline unsigned short atomic_fetch_or
2572 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2573 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2574
2575
2576 inline unsigned short atomic_fetch_xor_explicit
2577 ( volatile atomic_ushort* __a__, unsigned short __m__, memory_order __x__ )
2578 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2579
2580 inline unsigned short atomic_fetch_xor
2581 ( volatile atomic_ushort* __a__, unsigned short __m__ )
2582 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2583
2584
2585 inline int atomic_fetch_add_explicit
2586 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2587 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2588
2589 inline int atomic_fetch_add
2590 ( volatile atomic_int* __a__, int __m__ )
2591 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2592
2593
2594 inline int atomic_fetch_sub_explicit
2595 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2596 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2597
2598 inline int atomic_fetch_sub
2599 ( volatile atomic_int* __a__, int __m__ )
2600 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2601
2602
2603 inline int atomic_fetch_and_explicit
2604 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2605 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2606
2607 inline int atomic_fetch_and
2608 ( volatile atomic_int* __a__, int __m__ )
2609 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2610
2611
2612 inline int atomic_fetch_or_explicit
2613 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2614 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2615
2616 inline int atomic_fetch_or
2617 ( volatile atomic_int* __a__, int __m__ )
2618 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2619
2620
2621 inline int atomic_fetch_xor_explicit
2622 ( volatile atomic_int* __a__, int __m__, memory_order __x__ )
2623 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2624
2625 inline int atomic_fetch_xor
2626 ( volatile atomic_int* __a__, int __m__ )
2627 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2628
2629
2630 inline unsigned int atomic_fetch_add_explicit
2631 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2632 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2633
2634 inline unsigned int atomic_fetch_add
2635 ( volatile atomic_uint* __a__, unsigned int __m__ )
2636 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2637
2638
2639 inline unsigned int atomic_fetch_sub_explicit
2640 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2641 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2642
2643 inline unsigned int atomic_fetch_sub
2644 ( volatile atomic_uint* __a__, unsigned int __m__ )
2645 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2646
2647
2648 inline unsigned int atomic_fetch_and_explicit
2649 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2650 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2651
2652 inline unsigned int atomic_fetch_and
2653 ( volatile atomic_uint* __a__, unsigned int __m__ )
2654 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2655
2656
2657 inline unsigned int atomic_fetch_or_explicit
2658 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2659 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2660
2661 inline unsigned int atomic_fetch_or
2662 ( volatile atomic_uint* __a__, unsigned int __m__ )
2663 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2664
2665
2666 inline unsigned int atomic_fetch_xor_explicit
2667 ( volatile atomic_uint* __a__, unsigned int __m__, memory_order __x__ )
2668 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2669
2670 inline unsigned int atomic_fetch_xor
2671 ( volatile atomic_uint* __a__, unsigned int __m__ )
2672 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2673
2674
2675 inline long atomic_fetch_add_explicit
2676 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2677 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2678
2679 inline long atomic_fetch_add
2680 ( volatile atomic_long* __a__, long __m__ )
2681 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2682
2683
2684 inline long atomic_fetch_sub_explicit
2685 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2686 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2687
2688 inline long atomic_fetch_sub
2689 ( volatile atomic_long* __a__, long __m__ )
2690 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2691
2692
2693 inline long atomic_fetch_and_explicit
2694 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2695 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2696
2697 inline long atomic_fetch_and
2698 ( volatile atomic_long* __a__, long __m__ )
2699 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2700
2701
2702 inline long atomic_fetch_or_explicit
2703 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2704 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2705
2706 inline long atomic_fetch_or
2707 ( volatile atomic_long* __a__, long __m__ )
2708 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2709
2710
2711 inline long atomic_fetch_xor_explicit
2712 ( volatile atomic_long* __a__, long __m__, memory_order __x__ )
2713 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2714
2715 inline long atomic_fetch_xor
2716 ( volatile atomic_long* __a__, long __m__ )
2717 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2718
2719
2720 inline unsigned long atomic_fetch_add_explicit
2721 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2722 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2723
2724 inline unsigned long atomic_fetch_add
2725 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2726 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2727
2728
2729 inline unsigned long atomic_fetch_sub_explicit
2730 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2731 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2732
2733 inline unsigned long atomic_fetch_sub
2734 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2735 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2736
2737
2738 inline unsigned long atomic_fetch_and_explicit
2739 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2740 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2741
2742 inline unsigned long atomic_fetch_and
2743 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2744 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2745
2746
2747 inline unsigned long atomic_fetch_or_explicit
2748 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2749 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2750
2751 inline unsigned long atomic_fetch_or
2752 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2753 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2754
2755
2756 inline unsigned long atomic_fetch_xor_explicit
2757 ( volatile atomic_ulong* __a__, unsigned long __m__, memory_order __x__ )
2758 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2759
2760 inline unsigned long atomic_fetch_xor
2761 ( volatile atomic_ulong* __a__, unsigned long __m__ )
2762 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2763
2764
2765 inline long long atomic_fetch_add_explicit
2766 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2767 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2768
2769 inline long long atomic_fetch_add
2770 ( volatile atomic_llong* __a__, long long __m__ )
2771 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2772
2773
2774 inline long long atomic_fetch_sub_explicit
2775 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2776 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2777
2778 inline long long atomic_fetch_sub
2779 ( volatile atomic_llong* __a__, long long __m__ )
2780 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2781
2782
2783 inline long long atomic_fetch_and_explicit
2784 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2785 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2786
2787 inline long long atomic_fetch_and
2788 ( volatile atomic_llong* __a__, long long __m__ )
2789 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2790
2791
2792 inline long long atomic_fetch_or_explicit
2793 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2794 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2795
2796 inline long long atomic_fetch_or
2797 ( volatile atomic_llong* __a__, long long __m__ )
2798 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2799
2800
2801 inline long long atomic_fetch_xor_explicit
2802 ( volatile atomic_llong* __a__, long long __m__, memory_order __x__ )
2803 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2804
2805 inline long long atomic_fetch_xor
2806 ( volatile atomic_llong* __a__, long long __m__ )
2807 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2808
2809
2810 inline unsigned long long atomic_fetch_add_explicit
2811 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2812 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2813
2814 inline unsigned long long atomic_fetch_add
2815 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2816 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2817
2818
2819 inline unsigned long long atomic_fetch_sub_explicit
2820 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2821 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2822
2823 inline unsigned long long atomic_fetch_sub
2824 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2825 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2826
2827
2828 inline unsigned long long atomic_fetch_and_explicit
2829 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2830 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2831
2832 inline unsigned long long atomic_fetch_and
2833 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2834 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2835
2836
2837 inline unsigned long long atomic_fetch_or_explicit
2838 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2839 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2840
2841 inline unsigned long long atomic_fetch_or
2842 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2843 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2844
2845
2846 inline unsigned long long atomic_fetch_xor_explicit
2847 ( volatile atomic_ullong* __a__, unsigned long long __m__, memory_order __x__ )
2848 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2849
2850 inline unsigned long long atomic_fetch_xor
2851 ( volatile atomic_ullong* __a__, unsigned long long __m__ )
2852 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2853
2854
2855 inline wchar_t atomic_fetch_add_explicit
2856 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2857 { return _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ ); }
2858
2859 inline wchar_t atomic_fetch_add
2860 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2861 { return atomic_fetch_add_explicit( __a__, __m__, memory_order_seq_cst ); }
2862
2863
2864 inline wchar_t atomic_fetch_sub_explicit
2865 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2866 { return _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ ); }
2867
2868 inline wchar_t atomic_fetch_sub
2869 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2870 { return atomic_fetch_sub_explicit( __a__, __m__, memory_order_seq_cst ); }
2871
2872
2873 inline wchar_t atomic_fetch_and_explicit
2874 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2875 { return _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ ); }
2876
2877 inline wchar_t atomic_fetch_and
2878 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2879 { return atomic_fetch_and_explicit( __a__, __m__, memory_order_seq_cst ); }
2880
2881
2882 inline wchar_t atomic_fetch_or_explicit
2883 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2884 { return _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ ); }
2885
2886 inline wchar_t atomic_fetch_or
2887 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2888 { return atomic_fetch_or_explicit( __a__, __m__, memory_order_seq_cst ); }
2889
2890
2891 inline wchar_t atomic_fetch_xor_explicit
2892 ( volatile atomic_wchar_t* __a__, wchar_t __m__, memory_order __x__ )
2893 { return _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ ); }
2894
2895 inline wchar_t atomic_fetch_xor
2896 ( volatile atomic_wchar_t* __a__, wchar_t __m__ )
2897 { return atomic_fetch_xor_explicit( __a__, __m__, memory_order_seq_cst ); }
2898
2899
2900 #else
2901
2902
2903 #define atomic_is_lock_free( __a__ ) \
2904 false
2905
2906 #define atomic_load( __a__ ) \
2907 _ATOMIC_LOAD_( __a__, memory_order_seq_cst )
2908
2909 #define atomic_load_explicit( __a__, __x__ ) \
2910 _ATOMIC_LOAD_( __a__, __x__ )
2911
2912 #define atomic_init( __a__, __m__ ) \
2913 _ATOMIC_INIT_( __a__, __m__ )
2914
2915 #define atomic_store( __a__, __m__ ) \
2916 _ATOMIC_STORE_( __a__, __m__, memory_order_seq_cst )
2917
2918 #define atomic_store_explicit( __a__, __m__, __x__ ) \
2919 _ATOMIC_STORE_( __a__, __m__, __x__ )
2920
2921 #define atomic_exchange( __a__, __m__ ) \
2922 _ATOMIC_MODIFY_( __a__, =, __m__, memory_order_seq_cst )
2923
2924 #define atomic_exchange_explicit( __a__, __m__, __x__ ) \
2925 _ATOMIC_MODIFY_( __a__, =, __m__, __x__ )
2926
2927 #define atomic_compare_exchange_weak( __a__, __e__, __m__ ) \
2928 _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, memory_order_seq_cst )
2929
2930 #define atomic_compare_exchange_strong( __a__, __e__, __m__ ) \
2931 _ATOMIC_CMPSWP_( __a__, __e__, __m__, memory_order_seq_cst )
2932
2933 #define atomic_compare_exchange_weak_explicit( __a__, __e__, __m__, __x__, __y__ ) \
2934 _ATOMIC_CMPSWP_WEAK_( __a__, __e__, __m__, __x__ )
2935
2936 #define atomic_compare_exchange_strong_explicit( __a__, __e__, __m__, __x__, __y__ ) \
2937 _ATOMIC_CMPSWP_( __a__, __e__, __m__, __x__ )
2938
2939
2940 #define atomic_fetch_add_explicit( __a__, __m__, __x__ ) \
2941 _ATOMIC_MODIFY_( __a__, +=, __m__, __x__ )
2942
2943 #define atomic_fetch_add( __a__, __m__ ) \
2944 _ATOMIC_MODIFY_( __a__, +=, __m__, memory_order_seq_cst )
2945
2946
2947 #define atomic_fetch_sub_explicit( __a__, __m__, __x__ ) \
2948 _ATOMIC_MODIFY_( __a__, -=, __m__, __x__ )
2949
2950 #define atomic_fetch_sub( __a__, __m__ ) \
2951 _ATOMIC_MODIFY_( __a__, -=, __m__, memory_order_seq_cst )
2952
2953
2954 #define atomic_fetch_and_explicit( __a__, __m__, __x__ ) \
2955 _ATOMIC_MODIFY_( __a__, &=, __m__, __x__ )
2956
2957 #define atomic_fetch_and( __a__, __m__ ) \
2958 _ATOMIC_MODIFY_( __a__, &=, __m__, memory_order_seq_cst )
2959
2960
2961 #define atomic_fetch_or_explicit( __a__, __m__, __x__ ) \
2962 _ATOMIC_MODIFY_( __a__, |=, __m__, __x__ )
2963
2964 #define atomic_fetch_or( __a__, __m__ ) \
2965 _ATOMIC_MODIFY_( __a__, |=, __m__, memory_order_seq_cst )
2966
2967
2968 #define atomic_fetch_xor_explicit( __a__, __m__, __x__ ) \
2969 _ATOMIC_MODIFY_( __a__, ^=, __m__, __x__ )
2970
2971 #define atomic_fetch_xor( __a__, __m__ ) \
2972 _ATOMIC_MODIFY_( __a__, ^=, __m__, memory_order_seq_cst )
2973
2974
2975 #endif
2976
2977
2978 #ifdef __cplusplus
2979
2980
2981 inline bool atomic_bool::is_lock_free() const volatile
2982 { return false; }
2983
2984 inline void atomic_bool::store
2985 ( bool __m__, memory_order __x__ ) volatile
2986 { atomic_store_explicit( this, __m__, __x__ ); }
2987
2988 inline bool atomic_bool::load
2989 ( memory_order __x__ ) volatile
2990 { return atomic_load_explicit( this, __x__ ); }
2991
2992 inline bool atomic_bool::exchange
2993 ( bool __m__, memory_order __x__ ) volatile
2994 { return atomic_exchange_explicit( this, __m__, __x__ ); }
2995
2996 inline bool atomic_bool::compare_exchange_weak
2997 ( bool& __e__, bool __m__,
2998   memory_order __x__, memory_order __y__ ) volatile
2999 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3000
3001 inline bool atomic_bool::compare_exchange_strong
3002 ( bool& __e__, bool __m__,
3003   memory_order __x__, memory_order __y__ ) volatile
3004 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3005
3006 inline bool atomic_bool::compare_exchange_weak
3007 ( bool& __e__, bool __m__, memory_order __x__ ) volatile
3008 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3009       __x__ == memory_order_acq_rel ? memory_order_acquire :
3010       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3011
3012 inline bool atomic_bool::compare_exchange_strong
3013 ( bool& __e__, bool __m__, memory_order __x__ ) volatile
3014 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3015       __x__ == memory_order_acq_rel ? memory_order_acquire :
3016       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3017
3018
3019 inline bool atomic_address::is_lock_free() const volatile
3020 { return false; }
3021
3022 inline void atomic_address::store
3023 ( void* __m__, memory_order __x__ ) volatile
3024 { atomic_store_explicit( this, __m__, __x__ ); }
3025
3026 inline void* atomic_address::load
3027 ( memory_order __x__ ) volatile
3028 { return atomic_load_explicit( this, __x__ ); }
3029
3030 inline void* atomic_address::exchange
3031 ( void* __m__, memory_order __x__ ) volatile
3032 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3033
3034 inline bool atomic_address::compare_exchange_weak
3035 ( void*& __e__, void* __m__,
3036   memory_order __x__, memory_order __y__ ) volatile
3037 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3038
3039 inline bool atomic_address::compare_exchange_strong
3040 ( void*& __e__, void* __m__,
3041   memory_order __x__, memory_order __y__ ) volatile
3042 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3043
3044 inline bool atomic_address::compare_exchange_weak
3045 ( void*& __e__, void* __m__, memory_order __x__ ) volatile
3046 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3047       __x__ == memory_order_acq_rel ? memory_order_acquire :
3048       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3049
3050 inline bool atomic_address::compare_exchange_strong
3051 ( void*& __e__, void* __m__, memory_order __x__ ) volatile
3052 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3053       __x__ == memory_order_acq_rel ? memory_order_acquire :
3054       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3055
3056
3057 inline bool atomic_char::is_lock_free() const volatile
3058 { return false; }
3059
3060 inline void atomic_char::store
3061 ( char __m__, memory_order __x__ ) volatile
3062 { atomic_store_explicit( this, __m__, __x__ ); }
3063
3064 inline char atomic_char::load
3065 ( memory_order __x__ ) volatile
3066 { return atomic_load_explicit( this, __x__ ); }
3067
3068 inline char atomic_char::exchange
3069 ( char __m__, memory_order __x__ ) volatile
3070 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3071
3072 inline bool atomic_char::compare_exchange_weak
3073 ( char& __e__, char __m__,
3074   memory_order __x__, memory_order __y__ ) volatile
3075 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3076
3077 inline bool atomic_char::compare_exchange_strong
3078 ( char& __e__, char __m__,
3079   memory_order __x__, memory_order __y__ ) volatile
3080 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3081
3082 inline bool atomic_char::compare_exchange_weak
3083 ( char& __e__, char __m__, memory_order __x__ ) volatile
3084 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3085       __x__ == memory_order_acq_rel ? memory_order_acquire :
3086       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3087
3088 inline bool atomic_char::compare_exchange_strong
3089 ( char& __e__, char __m__, memory_order __x__ ) volatile
3090 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3091       __x__ == memory_order_acq_rel ? memory_order_acquire :
3092       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3093
3094
3095 inline bool atomic_schar::is_lock_free() const volatile
3096 { return false; }
3097
3098 inline void atomic_schar::store
3099 ( signed char __m__, memory_order __x__ ) volatile
3100 { atomic_store_explicit( this, __m__, __x__ ); }
3101
3102 inline signed char atomic_schar::load
3103 ( memory_order __x__ ) volatile
3104 { return atomic_load_explicit( this, __x__ ); }
3105
3106 inline signed char atomic_schar::exchange
3107 ( signed char __m__, memory_order __x__ ) volatile
3108 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3109
3110 inline bool atomic_schar::compare_exchange_weak
3111 ( signed char& __e__, signed char __m__,
3112   memory_order __x__, memory_order __y__ ) volatile
3113 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3114
3115 inline bool atomic_schar::compare_exchange_strong
3116 ( signed char& __e__, signed char __m__,
3117   memory_order __x__, memory_order __y__ ) volatile
3118 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3119
3120 inline bool atomic_schar::compare_exchange_weak
3121 ( signed char& __e__, signed char __m__, memory_order __x__ ) volatile
3122 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3123       __x__ == memory_order_acq_rel ? memory_order_acquire :
3124       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3125
3126 inline bool atomic_schar::compare_exchange_strong
3127 ( signed char& __e__, signed char __m__, memory_order __x__ ) volatile
3128 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3129       __x__ == memory_order_acq_rel ? memory_order_acquire :
3130       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3131
3132
3133 inline bool atomic_uchar::is_lock_free() const volatile
3134 { return false; }
3135
3136 inline void atomic_uchar::store
3137 ( unsigned char __m__, memory_order __x__ ) volatile
3138 { atomic_store_explicit( this, __m__, __x__ ); }
3139
3140 inline unsigned char atomic_uchar::load
3141 ( memory_order __x__ ) volatile
3142 { return atomic_load_explicit( this, __x__ ); }
3143
3144 inline unsigned char atomic_uchar::exchange
3145 ( unsigned char __m__, memory_order __x__ ) volatile
3146 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3147
3148 inline bool atomic_uchar::compare_exchange_weak
3149 ( unsigned char& __e__, unsigned char __m__,
3150   memory_order __x__, memory_order __y__ ) volatile
3151 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3152
3153 inline bool atomic_uchar::compare_exchange_strong
3154 ( unsigned char& __e__, unsigned char __m__,
3155   memory_order __x__, memory_order __y__ ) volatile
3156 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3157
3158 inline bool atomic_uchar::compare_exchange_weak
3159 ( unsigned char& __e__, unsigned char __m__, memory_order __x__ ) volatile
3160 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3161       __x__ == memory_order_acq_rel ? memory_order_acquire :
3162       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3163
3164 inline bool atomic_uchar::compare_exchange_strong
3165 ( unsigned char& __e__, unsigned char __m__, memory_order __x__ ) volatile
3166 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3167       __x__ == memory_order_acq_rel ? memory_order_acquire :
3168       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3169
3170
3171 inline bool atomic_short::is_lock_free() const volatile
3172 { return false; }
3173
3174 inline void atomic_short::store
3175 ( short __m__, memory_order __x__ ) volatile
3176 { atomic_store_explicit( this, __m__, __x__ ); }
3177
3178 inline short atomic_short::load
3179 ( memory_order __x__ ) volatile
3180 { return atomic_load_explicit( this, __x__ ); }
3181
3182 inline short atomic_short::exchange
3183 ( short __m__, memory_order __x__ ) volatile
3184 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3185
3186 inline bool atomic_short::compare_exchange_weak
3187 ( short& __e__, short __m__,
3188   memory_order __x__, memory_order __y__ ) volatile
3189 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3190
3191 inline bool atomic_short::compare_exchange_strong
3192 ( short& __e__, short __m__,
3193   memory_order __x__, memory_order __y__ ) volatile
3194 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3195
3196 inline bool atomic_short::compare_exchange_weak
3197 ( short& __e__, short __m__, memory_order __x__ ) volatile
3198 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3199       __x__ == memory_order_acq_rel ? memory_order_acquire :
3200       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3201
3202 inline bool atomic_short::compare_exchange_strong
3203 ( short& __e__, short __m__, memory_order __x__ ) volatile
3204 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3205       __x__ == memory_order_acq_rel ? memory_order_acquire :
3206       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3207
3208
3209 inline bool atomic_ushort::is_lock_free() const volatile
3210 { return false; }
3211
3212 inline void atomic_ushort::store
3213 ( unsigned short __m__, memory_order __x__ ) volatile
3214 { atomic_store_explicit( this, __m__, __x__ ); }
3215
3216 inline unsigned short atomic_ushort::load
3217 ( memory_order __x__ ) volatile
3218 { return atomic_load_explicit( this, __x__ ); }
3219
3220 inline unsigned short atomic_ushort::exchange
3221 ( unsigned short __m__, memory_order __x__ ) volatile
3222 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3223
3224 inline bool atomic_ushort::compare_exchange_weak
3225 ( unsigned short& __e__, unsigned short __m__,
3226   memory_order __x__, memory_order __y__ ) volatile
3227 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3228
3229 inline bool atomic_ushort::compare_exchange_strong
3230 ( unsigned short& __e__, unsigned short __m__,
3231   memory_order __x__, memory_order __y__ ) volatile
3232 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3233
3234 inline bool atomic_ushort::compare_exchange_weak
3235 ( unsigned short& __e__, unsigned short __m__, memory_order __x__ ) volatile
3236 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3237       __x__ == memory_order_acq_rel ? memory_order_acquire :
3238       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3239
3240 inline bool atomic_ushort::compare_exchange_strong
3241 ( unsigned short& __e__, unsigned short __m__, memory_order __x__ ) volatile
3242 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3243       __x__ == memory_order_acq_rel ? memory_order_acquire :
3244       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3245
3246
3247 inline bool atomic_int::is_lock_free() const volatile
3248 { return false; }
3249
3250 inline void atomic_int::store
3251 ( int __m__, memory_order __x__ ) volatile
3252 { atomic_store_explicit( this, __m__, __x__ ); }
3253
3254 inline int atomic_int::load
3255 ( memory_order __x__ ) volatile
3256 { return atomic_load_explicit( this, __x__ ); }
3257
3258 inline int atomic_int::exchange
3259 ( int __m__, memory_order __x__ ) volatile
3260 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3261
3262 inline bool atomic_int::compare_exchange_weak
3263 ( int& __e__, int __m__,
3264   memory_order __x__, memory_order __y__ ) volatile
3265 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3266
3267 inline bool atomic_int::compare_exchange_strong
3268 ( int& __e__, int __m__,
3269   memory_order __x__, memory_order __y__ ) volatile
3270 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3271
3272 inline bool atomic_int::compare_exchange_weak
3273 ( int& __e__, int __m__, memory_order __x__ ) volatile
3274 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3275       __x__ == memory_order_acq_rel ? memory_order_acquire :
3276       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3277
3278 inline bool atomic_int::compare_exchange_strong
3279 ( int& __e__, int __m__, memory_order __x__ ) volatile
3280 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3281       __x__ == memory_order_acq_rel ? memory_order_acquire :
3282       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3283
3284
3285 inline bool atomic_uint::is_lock_free() const volatile
3286 { return false; }
3287
3288 inline void atomic_uint::store
3289 ( unsigned int __m__, memory_order __x__ ) volatile
3290 { atomic_store_explicit( this, __m__, __x__ ); }
3291
3292 inline unsigned int atomic_uint::load
3293 ( memory_order __x__ ) volatile
3294 { return atomic_load_explicit( this, __x__ ); }
3295
3296 inline unsigned int atomic_uint::exchange
3297 ( unsigned int __m__, memory_order __x__ ) volatile
3298 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3299
3300 inline bool atomic_uint::compare_exchange_weak
3301 ( unsigned int& __e__, unsigned int __m__,
3302   memory_order __x__, memory_order __y__ ) volatile
3303 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3304
3305 inline bool atomic_uint::compare_exchange_strong
3306 ( unsigned int& __e__, unsigned int __m__,
3307   memory_order __x__, memory_order __y__ ) volatile
3308 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3309
3310 inline bool atomic_uint::compare_exchange_weak
3311 ( unsigned int& __e__, unsigned int __m__, memory_order __x__ ) volatile
3312 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3313       __x__ == memory_order_acq_rel ? memory_order_acquire :
3314       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3315
3316 inline bool atomic_uint::compare_exchange_strong
3317 ( unsigned int& __e__, unsigned int __m__, memory_order __x__ ) volatile
3318 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3319       __x__ == memory_order_acq_rel ? memory_order_acquire :
3320       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3321
3322
3323 inline bool atomic_long::is_lock_free() const volatile
3324 { return false; }
3325
3326 inline void atomic_long::store
3327 ( long __m__, memory_order __x__ ) volatile
3328 { atomic_store_explicit( this, __m__, __x__ ); }
3329
3330 inline long atomic_long::load
3331 ( memory_order __x__ ) volatile
3332 { return atomic_load_explicit( this, __x__ ); }
3333
3334 inline long atomic_long::exchange
3335 ( long __m__, memory_order __x__ ) volatile
3336 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3337
3338 inline bool atomic_long::compare_exchange_weak
3339 ( long& __e__, long __m__,
3340   memory_order __x__, memory_order __y__ ) volatile
3341 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3342
3343 inline bool atomic_long::compare_exchange_strong
3344 ( long& __e__, long __m__,
3345   memory_order __x__, memory_order __y__ ) volatile
3346 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3347
3348 inline bool atomic_long::compare_exchange_weak
3349 ( long& __e__, long __m__, memory_order __x__ ) volatile
3350 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3351       __x__ == memory_order_acq_rel ? memory_order_acquire :
3352       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3353
3354 inline bool atomic_long::compare_exchange_strong
3355 ( long& __e__, long __m__, memory_order __x__ ) volatile
3356 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3357       __x__ == memory_order_acq_rel ? memory_order_acquire :
3358       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3359
3360
3361 inline bool atomic_ulong::is_lock_free() const volatile
3362 { return false; }
3363
3364 inline void atomic_ulong::store
3365 ( unsigned long __m__, memory_order __x__ ) volatile
3366 { atomic_store_explicit( this, __m__, __x__ ); }
3367
3368 inline unsigned long atomic_ulong::load
3369 ( memory_order __x__ ) volatile
3370 { return atomic_load_explicit( this, __x__ ); }
3371
3372 inline unsigned long atomic_ulong::exchange
3373 ( unsigned long __m__, memory_order __x__ ) volatile
3374 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3375
3376 inline bool atomic_ulong::compare_exchange_weak
3377 ( unsigned long& __e__, unsigned long __m__,
3378   memory_order __x__, memory_order __y__ ) volatile
3379 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3380
3381 inline bool atomic_ulong::compare_exchange_strong
3382 ( unsigned long& __e__, unsigned long __m__,
3383   memory_order __x__, memory_order __y__ ) volatile
3384 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3385
3386 inline bool atomic_ulong::compare_exchange_weak
3387 ( unsigned long& __e__, unsigned long __m__, memory_order __x__ ) volatile
3388 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3389       __x__ == memory_order_acq_rel ? memory_order_acquire :
3390       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3391
3392 inline bool atomic_ulong::compare_exchange_strong
3393 ( unsigned long& __e__, unsigned long __m__, memory_order __x__ ) volatile
3394 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3395       __x__ == memory_order_acq_rel ? memory_order_acquire :
3396       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3397
3398
3399 inline bool atomic_llong::is_lock_free() const volatile
3400 { return false; }
3401
3402 inline void atomic_llong::store
3403 ( long long __m__, memory_order __x__ ) volatile
3404 { atomic_store_explicit( this, __m__, __x__ ); }
3405
3406 inline long long atomic_llong::load
3407 ( memory_order __x__ ) volatile
3408 { return atomic_load_explicit( this, __x__ ); }
3409
3410 inline long long atomic_llong::exchange
3411 ( long long __m__, memory_order __x__ ) volatile
3412 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3413
3414 inline bool atomic_llong::compare_exchange_weak
3415 ( long long& __e__, long long __m__,
3416   memory_order __x__, memory_order __y__ ) volatile
3417 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3418
3419 inline bool atomic_llong::compare_exchange_strong
3420 ( long long& __e__, long long __m__,
3421   memory_order __x__, memory_order __y__ ) volatile
3422 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3423
3424 inline bool atomic_llong::compare_exchange_weak
3425 ( long long& __e__, long long __m__, memory_order __x__ ) volatile
3426 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3427       __x__ == memory_order_acq_rel ? memory_order_acquire :
3428       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3429
3430 inline bool atomic_llong::compare_exchange_strong
3431 ( long long& __e__, long long __m__, memory_order __x__ ) volatile
3432 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3433       __x__ == memory_order_acq_rel ? memory_order_acquire :
3434       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3435
3436
3437 inline bool atomic_ullong::is_lock_free() const volatile
3438 { return false; }
3439
3440 inline void atomic_ullong::store
3441 ( unsigned long long __m__, memory_order __x__ ) volatile
3442 { atomic_store_explicit( this, __m__, __x__ ); }
3443
3444 inline unsigned long long atomic_ullong::load
3445 ( memory_order __x__ ) volatile
3446 { return atomic_load_explicit( this, __x__ ); }
3447
3448 inline unsigned long long atomic_ullong::exchange
3449 ( unsigned long long __m__, memory_order __x__ ) volatile
3450 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3451
3452 inline bool atomic_ullong::compare_exchange_weak
3453 ( unsigned long long& __e__, unsigned long long __m__,
3454   memory_order __x__, memory_order __y__ ) volatile
3455 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3456
3457 inline bool atomic_ullong::compare_exchange_strong
3458 ( unsigned long long& __e__, unsigned long long __m__,
3459   memory_order __x__, memory_order __y__ ) volatile
3460 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3461
3462 inline bool atomic_ullong::compare_exchange_weak
3463 ( unsigned long long& __e__, unsigned long long __m__, memory_order __x__ ) volatile
3464 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3465       __x__ == memory_order_acq_rel ? memory_order_acquire :
3466       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3467
3468 inline bool atomic_ullong::compare_exchange_strong
3469 ( unsigned long long& __e__, unsigned long long __m__, memory_order __x__ ) volatile
3470 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3471       __x__ == memory_order_acq_rel ? memory_order_acquire :
3472       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3473
3474
3475 inline bool atomic_wchar_t::is_lock_free() const volatile
3476 { return false; }
3477
3478 inline void atomic_wchar_t::store
3479 ( wchar_t __m__, memory_order __x__ ) volatile
3480 { atomic_store_explicit( this, __m__, __x__ ); }
3481
3482 inline wchar_t atomic_wchar_t::load
3483 ( memory_order __x__ ) volatile
3484 { return atomic_load_explicit( this, __x__ ); }
3485
3486 inline wchar_t atomic_wchar_t::exchange
3487 ( wchar_t __m__, memory_order __x__ ) volatile
3488 { return atomic_exchange_explicit( this, __m__, __x__ ); }
3489
3490 inline bool atomic_wchar_t::compare_exchange_weak
3491 ( wchar_t& __e__, wchar_t __m__,
3492   memory_order __x__, memory_order __y__ ) volatile
3493 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__, __y__ ); }
3494
3495 inline bool atomic_wchar_t::compare_exchange_strong
3496 ( wchar_t& __e__, wchar_t __m__,
3497   memory_order __x__, memory_order __y__ ) volatile
3498 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__, __y__ ); }
3499
3500 inline bool atomic_wchar_t::compare_exchange_weak
3501 ( wchar_t& __e__, wchar_t __m__, memory_order __x__ ) volatile
3502 { return atomic_compare_exchange_weak_explicit( this, &__e__, __m__, __x__,
3503       __x__ == memory_order_acq_rel ? memory_order_acquire :
3504       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3505
3506 inline bool atomic_wchar_t::compare_exchange_strong
3507 ( wchar_t& __e__, wchar_t __m__, memory_order __x__ ) volatile
3508 { return atomic_compare_exchange_strong_explicit( this, &__e__, __m__, __x__,
3509       __x__ == memory_order_acq_rel ? memory_order_acquire :
3510       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3511
3512
3513 template< typename T >
3514 inline bool atomic<T>::is_lock_free() const volatile
3515 { return false; }
3516
3517 template< typename T >
3518 inline void atomic<T>::store( T __v__, memory_order __x__ ) volatile
3519 { _ATOMIC_STORE_( this, __v__, __x__ ); }
3520
3521 template< typename T >
3522 inline T atomic<T>::load( memory_order __x__ ) volatile
3523 { return _ATOMIC_LOAD_( this, __x__ ); }
3524
3525 template< typename T >
3526 inline T atomic<T>::exchange( T __v__, memory_order __x__ ) volatile
3527 { return _ATOMIC_MODIFY_( this, =, __v__, __x__ ); }
3528
3529 template< typename T >
3530 inline bool atomic<T>::compare_exchange_weak
3531 ( T& __r__, T __v__, memory_order __x__, memory_order __y__ ) volatile
3532 { return _ATOMIC_CMPSWP_WEAK_( this, &__r__, __v__, __x__ ); }
3533
3534 template< typename T >
3535 inline bool atomic<T>::compare_exchange_strong
3536 ( T& __r__, T __v__, memory_order __x__, memory_order __y__ ) volatile
3537 { return _ATOMIC_CMPSWP_( this, &__r__, __v__, __x__ ); }
3538
3539 template< typename T >
3540 inline bool atomic<T>::compare_exchange_weak
3541 ( T& __r__, T __v__, memory_order __x__ ) volatile
3542 { return compare_exchange_weak( __r__, __v__, __x__,
3543       __x__ == memory_order_acq_rel ? memory_order_acquire :
3544       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3545
3546 template< typename T >
3547 inline bool atomic<T>::compare_exchange_strong
3548 ( T& __r__, T __v__, memory_order __x__ ) volatile
3549 { return compare_exchange_strong( __r__, __v__, __x__,
3550       __x__ == memory_order_acq_rel ? memory_order_acquire :
3551       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3552
3553
3554 inline void* atomic_address::fetch_add
3555 ( ptrdiff_t __m__, memory_order __x__ ) volatile
3556 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3557
3558 inline void* atomic_address::fetch_sub
3559 ( ptrdiff_t __m__, memory_order __x__ ) volatile
3560 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3561
3562
3563 inline char atomic_char::fetch_add
3564 ( char __m__, memory_order __x__ ) volatile
3565 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3566
3567
3568 inline char atomic_char::fetch_sub
3569 ( char __m__, memory_order __x__ ) volatile
3570 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3571
3572
3573 inline char atomic_char::fetch_and
3574 ( char __m__, memory_order __x__ ) volatile
3575 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3576
3577
3578 inline char atomic_char::fetch_or
3579 ( char __m__, memory_order __x__ ) volatile
3580 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3581
3582
3583 inline char atomic_char::fetch_xor
3584 ( char __m__, memory_order __x__ ) volatile
3585 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3586
3587
3588 inline signed char atomic_schar::fetch_add
3589 ( signed char __m__, memory_order __x__ ) volatile
3590 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3591
3592
3593 inline signed char atomic_schar::fetch_sub
3594 ( signed char __m__, memory_order __x__ ) volatile
3595 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3596
3597
3598 inline signed char atomic_schar::fetch_and
3599 ( signed char __m__, memory_order __x__ ) volatile
3600 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3601
3602
3603 inline signed char atomic_schar::fetch_or
3604 ( signed char __m__, memory_order __x__ ) volatile
3605 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3606
3607
3608 inline signed char atomic_schar::fetch_xor
3609 ( signed char __m__, memory_order __x__ ) volatile
3610 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3611
3612
3613 inline unsigned char atomic_uchar::fetch_add
3614 ( unsigned char __m__, memory_order __x__ ) volatile
3615 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3616
3617
3618 inline unsigned char atomic_uchar::fetch_sub
3619 ( unsigned char __m__, memory_order __x__ ) volatile
3620 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3621
3622
3623 inline unsigned char atomic_uchar::fetch_and
3624 ( unsigned char __m__, memory_order __x__ ) volatile
3625 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3626
3627
3628 inline unsigned char atomic_uchar::fetch_or
3629 ( unsigned char __m__, memory_order __x__ ) volatile
3630 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3631
3632
3633 inline unsigned char atomic_uchar::fetch_xor
3634 ( unsigned char __m__, memory_order __x__ ) volatile
3635 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3636
3637
3638 inline short atomic_short::fetch_add
3639 ( short __m__, memory_order __x__ ) volatile
3640 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3641
3642
3643 inline short atomic_short::fetch_sub
3644 ( short __m__, memory_order __x__ ) volatile
3645 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3646
3647
3648 inline short atomic_short::fetch_and
3649 ( short __m__, memory_order __x__ ) volatile
3650 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3651
3652
3653 inline short atomic_short::fetch_or
3654 ( short __m__, memory_order __x__ ) volatile
3655 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3656
3657
3658 inline short atomic_short::fetch_xor
3659 ( short __m__, memory_order __x__ ) volatile
3660 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3661
3662
3663 inline unsigned short atomic_ushort::fetch_add
3664 ( unsigned short __m__, memory_order __x__ ) volatile
3665 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3666
3667
3668 inline unsigned short atomic_ushort::fetch_sub
3669 ( unsigned short __m__, memory_order __x__ ) volatile
3670 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3671
3672
3673 inline unsigned short atomic_ushort::fetch_and
3674 ( unsigned short __m__, memory_order __x__ ) volatile
3675 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3676
3677
3678 inline unsigned short atomic_ushort::fetch_or
3679 ( unsigned short __m__, memory_order __x__ ) volatile
3680 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3681
3682
3683 inline unsigned short atomic_ushort::fetch_xor
3684 ( unsigned short __m__, memory_order __x__ ) volatile
3685 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3686
3687
3688 inline int atomic_int::fetch_add
3689 ( int __m__, memory_order __x__ ) volatile
3690 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3691
3692
3693 inline int atomic_int::fetch_sub
3694 ( int __m__, memory_order __x__ ) volatile
3695 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3696
3697
3698 inline int atomic_int::fetch_and
3699 ( int __m__, memory_order __x__ ) volatile
3700 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3701
3702
3703 inline int atomic_int::fetch_or
3704 ( int __m__, memory_order __x__ ) volatile
3705 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3706
3707
3708 inline int atomic_int::fetch_xor
3709 ( int __m__, memory_order __x__ ) volatile
3710 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3711
3712
3713 inline unsigned int atomic_uint::fetch_add
3714 ( unsigned int __m__, memory_order __x__ ) volatile
3715 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3716
3717
3718 inline unsigned int atomic_uint::fetch_sub
3719 ( unsigned int __m__, memory_order __x__ ) volatile
3720 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3721
3722
3723 inline unsigned int atomic_uint::fetch_and
3724 ( unsigned int __m__, memory_order __x__ ) volatile
3725 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3726
3727
3728 inline unsigned int atomic_uint::fetch_or
3729 ( unsigned int __m__, memory_order __x__ ) volatile
3730 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3731
3732
3733 inline unsigned int atomic_uint::fetch_xor
3734 ( unsigned int __m__, memory_order __x__ ) volatile
3735 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3736
3737
3738 inline long atomic_long::fetch_add
3739 ( long __m__, memory_order __x__ ) volatile
3740 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3741
3742
3743 inline long atomic_long::fetch_sub
3744 ( long __m__, memory_order __x__ ) volatile
3745 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3746
3747
3748 inline long atomic_long::fetch_and
3749 ( long __m__, memory_order __x__ ) volatile
3750 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3751
3752
3753 inline long atomic_long::fetch_or
3754 ( long __m__, memory_order __x__ ) volatile
3755 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3756
3757
3758 inline long atomic_long::fetch_xor
3759 ( long __m__, memory_order __x__ ) volatile
3760 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3761
3762
3763 inline unsigned long atomic_ulong::fetch_add
3764 ( unsigned long __m__, memory_order __x__ ) volatile
3765 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3766
3767
3768 inline unsigned long atomic_ulong::fetch_sub
3769 ( unsigned long __m__, memory_order __x__ ) volatile
3770 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3771
3772
3773 inline unsigned long atomic_ulong::fetch_and
3774 ( unsigned long __m__, memory_order __x__ ) volatile
3775 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3776
3777
3778 inline unsigned long atomic_ulong::fetch_or
3779 ( unsigned long __m__, memory_order __x__ ) volatile
3780 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3781
3782
3783 inline unsigned long atomic_ulong::fetch_xor
3784 ( unsigned long __m__, memory_order __x__ ) volatile
3785 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3786
3787
3788 inline long long atomic_llong::fetch_add
3789 ( long long __m__, memory_order __x__ ) volatile
3790 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3791
3792
3793 inline long long atomic_llong::fetch_sub
3794 ( long long __m__, memory_order __x__ ) volatile
3795 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3796
3797
3798 inline long long atomic_llong::fetch_and
3799 ( long long __m__, memory_order __x__ ) volatile
3800 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3801
3802
3803 inline long long atomic_llong::fetch_or
3804 ( long long __m__, memory_order __x__ ) volatile
3805 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3806
3807
3808 inline long long atomic_llong::fetch_xor
3809 ( long long __m__, memory_order __x__ ) volatile
3810 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3811
3812
3813 inline unsigned long long atomic_ullong::fetch_add
3814 ( unsigned long long __m__, memory_order __x__ ) volatile
3815 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3816
3817
3818 inline unsigned long long atomic_ullong::fetch_sub
3819 ( unsigned long long __m__, memory_order __x__ ) volatile
3820 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3821
3822
3823 inline unsigned long long atomic_ullong::fetch_and
3824 ( unsigned long long __m__, memory_order __x__ ) volatile
3825 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3826
3827
3828 inline unsigned long long atomic_ullong::fetch_or
3829 ( unsigned long long __m__, memory_order __x__ ) volatile
3830 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3831
3832
3833 inline unsigned long long atomic_ullong::fetch_xor
3834 ( unsigned long long __m__, memory_order __x__ ) volatile
3835 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3836
3837
3838 inline wchar_t atomic_wchar_t::fetch_add
3839 ( wchar_t __m__, memory_order __x__ ) volatile
3840 { return atomic_fetch_add_explicit( this, __m__, __x__ ); }
3841
3842
3843 inline wchar_t atomic_wchar_t::fetch_sub
3844 ( wchar_t __m__, memory_order __x__ ) volatile
3845 { return atomic_fetch_sub_explicit( this, __m__, __x__ ); }
3846
3847
3848 inline wchar_t atomic_wchar_t::fetch_and
3849 ( wchar_t __m__, memory_order __x__ ) volatile
3850 { return atomic_fetch_and_explicit( this, __m__, __x__ ); }
3851
3852
3853 inline wchar_t atomic_wchar_t::fetch_or
3854 ( wchar_t __m__, memory_order __x__ ) volatile
3855 { return atomic_fetch_or_explicit( this, __m__, __x__ ); }
3856
3857
3858 inline wchar_t atomic_wchar_t::fetch_xor
3859 ( wchar_t __m__, memory_order __x__ ) volatile
3860 { return atomic_fetch_xor_explicit( this, __m__, __x__ ); }
3861
3862
3863 template< typename T >
3864 T* atomic<T*>::load( memory_order __x__ ) volatile
3865 { return static_cast<T*>( atomic_address::load( __x__ ) ); }
3866
3867 template< typename T >
3868 T* atomic<T*>::exchange( T* __v__, memory_order __x__ ) volatile
3869 { return static_cast<T*>( atomic_address::exchange( __v__, __x__ ) ); }
3870
3871 template< typename T >
3872 bool atomic<T*>::compare_exchange_weak
3873 ( T*& __r__, T* __v__, memory_order __x__, memory_order __y__) volatile
3874 { return atomic_address::compare_exchange_weak( *reinterpret_cast<void**>( &__r__ ),
3875                static_cast<void*>( __v__ ), __x__, __y__ ); }
3876 //{ return _ATOMIC_CMPSWP_WEAK_( this, &__r__, __v__, __x__ ); }
3877
3878 template< typename T >
3879 bool atomic<T*>::compare_exchange_strong
3880 ( T*& __r__, T* __v__, memory_order __x__, memory_order __y__) volatile
3881 { return atomic_address::compare_exchange_strong( *reinterpret_cast<void**>( &__r__ ),
3882                static_cast<void*>( __v__ ), __x__, __y__ ); }
3883 //{ return _ATOMIC_CMPSWP_( this, &__r__, __v__, __x__ ); }
3884
3885 template< typename T >
3886 bool atomic<T*>::compare_exchange_weak
3887 ( T*& __r__, T* __v__, memory_order __x__ ) volatile
3888 { return compare_exchange_weak( __r__, __v__, __x__,
3889       __x__ == memory_order_acq_rel ? memory_order_acquire :
3890       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3891
3892 template< typename T >
3893 bool atomic<T*>::compare_exchange_strong
3894 ( T*& __r__, T* __v__, memory_order __x__ ) volatile
3895 { return compare_exchange_strong( __r__, __v__, __x__,
3896       __x__ == memory_order_acq_rel ? memory_order_acquire :
3897       __x__ == memory_order_release ? memory_order_relaxed : __x__ ); }
3898
3899 template< typename T >
3900 T* atomic<T*>::fetch_add( ptrdiff_t __v__, memory_order __x__ ) volatile
3901 { return atomic_fetch_add_explicit( this, sizeof(T) * __v__, __x__ ); }
3902
3903 template< typename T >
3904 T* atomic<T*>::fetch_sub( ptrdiff_t __v__, memory_order __x__ ) volatile
3905 { return atomic_fetch_sub_explicit( this, sizeof(T) * __v__, __x__ ); }
3906
3907
3908 #endif
3909
3910 #ifdef __cplusplus
3911 extern "C" {
3912 #endif
3913 static inline void atomic_thread_fence(memory_order order)
3914 { _ATOMIC_FENCE_(order); }
3915
3916 /** @todo Do we want to try to support a user's signal-handler? */
3917 static inline void atomic_signal_fence(memory_order order)
3918 { /* No-op? */ }
3919 #ifdef __cplusplus
3920 }
3921 #endif
3922
3923
3924 #ifdef __cplusplus
3925 } // namespace std
3926 #endif
3927
3928 #endif /* __IMPATOMIC_H__ */