Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Base - API - Platform [Atomic].h_inc
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/* == Common ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Functions                                                                                                                                                      */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- Atomic ---------------------------------------------------------------------------------------------------------------------------------------------------------- */

TgINLINE TgVOID                             F(tgAM, _WRITE_FENCE)( TgVOID );
TgINLINE TgVOID                             F(tgAM, _READ_FENCE)( TgVOID );
TgINLINE TgVOID                             F(tgAM, _FULL_FENCE)( TgVOID );

/* ---- Atomic Pointer Functions ---------------------------------------------------------------------------------------------------------------------------------------- */

TgINLINE P_TgVOID                           F(tgAMPT, _READ)( TgATOMIC_PVOID volatile* );
TgINLINE TgVOID                             F(tgAMPT, _WRITE)( TgATOMIC_PVOID volatile*, PC_TgVOID );
TgINLINE P_TgVOID                           F(tgAMPT, _XCHG)( TgATOMIC_PVOID volatile*, PC_TgVOID );
TgINLINE P_TgVOID                           F(tgAMPT, _XCMP)( TgATOMIC_PVOID volatile*, PC_TgVOID, PC_TgVOID );

TgINLINE TgUINTXX                           F(tgAMXX, _XADD)( TgATOMIC_UINTXX volatile*, C_TgUINTXX );
TgINLINE TgUINTXX                           F(tgAMXX, _XSUB)( TgATOMIC_UINTXX volatile*, C_TgUINTXX );
TgINLINE TgUINTXX                           F(tgAMXX, _AND)( TgATOMIC_UINTXX volatile*, C_TgUINTXX );
TgINLINE TgUINTXX                           F(tgAMXX, _OR)( TgATOMIC_UINTXX volatile*, C_TgUINTXX );
TgINLINE TgUINTXX                           F(tgAMXX, _XOR)( TgATOMIC_UINTXX volatile*, C_TgUINTXX );
TgINLINE TgUINTXX                           F(tgAMXX, _INC)( TgATOMIC_UINTXX volatile* );
TgINLINE TgUINTXX                           F(tgAMXX, _DEC)( TgATOMIC_UINTXX volatile* );

TgINLINE TgUINTXX                           F(tgAMXX, _READ)( TgATOMIC_UINTXX volatile* );
TgINLINE TgVOID                             F(tgAMXX, _WRITE)( TgATOMIC_UINTXX volatile*, C_TgUINTXX );
TgINLINE TgUINTXX                           F(tgAMXX, _XCHG)( TgATOMIC_UINTXX volatile*, C_TgUINTXX );
TgINLINE TgUINTXX                           F(tgAMXX, _XCMP)( TgATOMIC_UINTXX volatile*, C_TgUINTXX, C_TgUINTXX );
TgINLINE TgBOOL                             F(tgAMXX, _XCMP2)( TgATOMIC_UINTXX volatile*, C_TgUINTXX, C_TgUINTXX, PC_TgUINTXX );

/* ---- Atomic 16bit Functions ------------------------------------------------------------------------------------------------------------------------------------------ */
#if TgCOMPILE_16BIT_ATOMIC

TgINLINE TgSINT16                           F(tgAM16, _READ)( TgATOMIC_SINT16 volatile* );
TgINLINE TgVOID                             F(tgAM16, _WRITE)( TgATOMIC_SINT16 volatile*, C_TgSINT16 );
TgINLINE TgSINT16                           F(tgAM16, _AND)( TgATOMIC_SINT16 volatile*, C_TgSINT16 );
TgINLINE TgSINT16                           F(tgAM16, _OR)( TgATOMIC_SINT16 volatile*, C_TgSINT16 );
TgINLINE TgSINT16                           F(tgAM16, _XOR)( TgATOMIC_SINT16 volatile*, C_TgSINT16 );
TgINLINE TgSINT16                           F(tgAM16, _INC)( TgATOMIC_SINT16 volatile* );
TgINLINE TgSINT16                           F(tgAM16, _DEC)( TgATOMIC_SINT16 volatile* );

/*# TgCOMPILE_16BIT_ATOMIC */
#endif

/* ---- Atomic 32bit Functions ------------------------------------------------------------------------------------------------------------------------------------------ */

TgINLINE TgSINT32                           F(tgAM32, _READ)( TgATOMIC_SINT32 volatile* );
TgINLINE TgVOID                             F(tgAM32, _WRITE)( TgATOMIC_SINT32 volatile*, C_TgSINT32 );

TgINLINE TgSINT32                           F(tgAM32, _XADD)( TgATOMIC_SINT32 volatile*, C_TgSINT32 );
TgINLINE TgSINT32                           F(tgAM32, _XSUB)( TgATOMIC_SINT32 volatile*, C_TgSINT32 );
TgINLINE TgSINT32                           F(tgAM32, _AND)( TgATOMIC_SINT32 volatile*, C_TgSINT32 );
TgINLINE TgSINT32                           F(tgAM32, _OR)( TgATOMIC_SINT32 volatile*, C_TgSINT32 );
TgINLINE TgSINT32                           F(tgAM32, _XOR)( TgATOMIC_SINT32 volatile*, C_TgSINT32 );
TgINLINE TgSINT32                           F(tgAM32, _INC)( TgATOMIC_SINT32 volatile* ); /*« The return value is the resulting incremented value. */
TgINLINE TgSINT32                           F(tgAM32, _DEC)( TgATOMIC_SINT32 volatile* );
TgINLINE TgSINT32                           F(tgAM32, _XCHG)( TgATOMIC_SINT32 volatile*, C_TgSINT32 );
TgINLINE TgSINT32                           F(tgAM32, _XCMP)( TgATOMIC_SINT32 volatile*, C_TgSINT32, C_TgSINT32 );
TgINLINE TgSINT64                           F(tgAM64, _XCMP)( TgATOMIC_SINT64 volatile*, C_TgSINT64, C_TgSINT64 );

/* ---- Atomic 64bit Functions ------------------------------------------------------------------------------------------------------------------------------------------ */
#if TgCOMPILE_64BIT_ATOMIC

TgINLINE TgSINT64                           F(tgAM64, _READ)( TgATOMIC_SINT64 volatile* );
TgINLINE TgVOID                             F(tgAM64, _WRITE)( TgATOMIC_SINT64 volatile*, C_TgSINT64 );

TgINLINE TgSINT64                           F(tgAM64, _XADD)( TgATOMIC_SINT64 volatile*, C_TgSINT64 );
TgINLINE TgSINT64                           F(tgAM64, _XSUB)( TgATOMIC_SINT64 volatile*, C_TgSINT64 );
TgINLINE TgSINT64                           F(tgAM64, _AND)( TgATOMIC_SINT64 volatile*, C_TgSINT64 );
TgINLINE TgSINT64                           F(tgAM64, _OR)( TgATOMIC_SINT64 volatile*, C_TgSINT64 );
TgINLINE TgSINT64                           F(tgAM64, _XOR)( TgATOMIC_SINT64 volatile*, C_TgSINT64 );
TgINLINE TgSINT64                           F(tgAM64, _INC)( TgATOMIC_SINT64 volatile* );
TgINLINE TgSINT64                           F(tgAM64, _DEC)( TgATOMIC_SINT64 volatile* );
TgINLINE TgSINT64                           F(tgAM64, _XCHG)( TgATOMIC_SINT64 volatile*, C_TgSINT64 );
TgINLINE TgBOOL                             F(tgAM64, _XCMP2)( TgATOMIC_SINT64 volatile*, C_TgSINT64, C_TgSINT64, P_TgSINT64 );

/*# TgCOMPILE_64BIT_ATOMIC */
#endif