1 #include "lfds611_abstraction_internal_body.h"
7 /****************************************************************************/
8 #if (defined _WIN64 && defined _MSC_VER)
10 /* TRD : 64 bit Windows (user-mode or kernel) on any CPU with the Microsoft C compiler
12 _WIN64 indicates 64 bit Windows
13 _MSC_VER indicates Microsoft C compiler
16 static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_increment( volatile lfds611_atom_t *value )
21 assert( value != NULL );
23 LFDS611_BARRIER_COMPILER_FULL;
25 rv = (lfds611_atom_t) _InterlockedIncrement64( (__int64 *) value );
27 LFDS611_BARRIER_COMPILER_FULL;
38 /****************************************************************************/
39 #if (!defined _WIN64 && defined _WIN32 && defined _MSC_VER)
41 /* TRD : 32 bit Windows (user-mode or kernel) on any CPU with the Microsoft C compiler
43 (!defined _WIN64 && defined _WIN32) indicates 32 bit Windows
44 _MSC_VER indicates Microsoft C compiler
47 static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_increment( volatile lfds611_atom_t *value )
52 assert( value != NULL );
54 LFDS611_BARRIER_COMPILER_FULL;
56 rv = (lfds611_atom_t) _InterlockedIncrement( (long int *) value );
58 LFDS611_BARRIER_COMPILER_FULL;
69 /****************************************************************************/
70 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && __GNUC_PATCHLEVEL__ >= 0)
72 /* TRD : any OS on any CPU with GCC 4.1.0 or better
74 GCC 4.1.0 introduced the __sync_*() atomic intrinsics
76 __GNUC__ / __GNUC_MINOR__ / __GNUC_PATCHLEVEL__ indicates GCC and which version
79 static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_increment( volatile lfds611_atom_t *value )
84 assert( value != NULL );
86 // TRD : no need for casting here, GCC has a __sync_add_and_fetch() for all native types
88 LFDS611_BARRIER_COMPILER_FULL;
90 rv = (lfds611_atom_t) __sync_add_and_fetch( value, 1 );
92 LFDS611_BARRIER_COMPILER_FULL;