1 #include "lfds610_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 LFDS610_INLINE lfds610_atom_t lfds610_abstraction_increment( volatile lfds610_atom_t *value )
18 assert( value != NULL );
20 return( (lfds610_atom_t) _InterlockedIncrement64((__int64 *) value) );
29 /****************************************************************************/
30 #if (!defined _WIN64 && defined _WIN32 && defined _MSC_VER)
32 /* TRD : 32 bit Windows (user-mode or kernel) on any CPU with the Microsoft C compiler
34 (!defined _WIN64 && defined _WIN32) indicates 32 bit Windows
35 _MSC_VER indicates Microsoft C compiler
38 static LFDS610_INLINE lfds610_atom_t lfds610_abstraction_increment( volatile lfds610_atom_t *value )
40 assert( value != NULL );
42 return( (lfds610_atom_t) _InterlockedIncrement((long int *) value) );
51 /****************************************************************************/
52 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && __GNUC_PATCHLEVEL__ >= 0)
54 /* TRD : any OS on any CPU with GCC 4.1.0 or better
56 GCC 4.1.0 introduced the __sync_*() atomic intrinsics
58 __GNUC__ / __GNUC_MINOR__ / __GNUC_PATCHLEVEL__ indicates GCC and which version
61 static LFDS610_INLINE lfds610_atom_t lfds610_abstraction_increment( volatile lfds610_atom_t *value )
63 assert( value != NULL );
65 // TRD : no need for casting here, GCC has a __sync_add_and_fetch() for all native types
67 return( (lfds610_atom_t) __sync_add_and_fetch(value, 1) );