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