Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS (MSVC-X86) Common - Base - API - Platform.inl
    »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".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
#if !defined(TGS_COMMON_BASE_PLATFORM_API_INL) /* Override the ANSI version of the file */
#define TGS_COMMON_BASE_PLATFORM_API_INL
#pragma once


/* == Common ============================================================================================================================================================ */

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

/* ---- tgPM_Break ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgPM_Break( TgVOID )
{
    TgBREAK_INLINE;
}


/* ---- tgPM_Abort ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgPM_Abort( TgVOID )
{
    TgBREAK_INLINE;
    abort();
}


/* ---- tgPM_BSR_U08 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT32 tgPM_BSR_U08( C_TgUINT08 uiVal )
{
    unsigned long iResult;
    return ((0 != _BitScanReverse( &iResult, uiVal )) ? (TgSINT32)iResult : -1);
}


/* ---- tgPM_BSR_U16 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT32 tgPM_BSR_U16( C_TgUINT16 uiVal )
{
    unsigned long iResult;
    return ((0 != _BitScanReverse( &iResult, uiVal )) ? (TgSINT32)iResult : -1);
}


/* ---- tgPM_BSR_U32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT32 tgPM_BSR_U32( C_TgUINT32 uiVal )
{
    unsigned long iResult;
    return ((0 != _BitScanReverse( &iResult, uiVal )) ? (TgSINT32)iResult : -1);
}


/* ---- tgPM_BSR_U64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT32 tgPM_BSR_U64( C_TgUINT64 uiVal )
{
#if defined(_WIN64)
    unsigned long iResult;
    return ((0 != _BitScanReverse64( &iResult, uiVal )) ? (TgSINT32)iResult : -1);
#else
    TgSINT32 iResult = tgPM_BSR_U32( (uiVal)& KTgMAX_U32 );
    if (iResult < 0)
    {
        iResult = tgPM_BSR_U32( (uiVal) >> 32 );

        if (iResult >= 0)
        {
            iResult += 32;
        };
    };

    return (iResult);
#endif
}


/* ---- tgPM_BSR_UXX ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT32 tgPM_BSR_UXX( C_TgSIZE uiVal )
{
#if TgCOMPILE_64BIT_POINTER
    return (tgPM_BSR_U64( uiVal ));
#elif TgCOMPILE_32BIT_POINTER
    return (tgPM_BSR_U32( uiVal ));
#else
    #error Unsupported pointer size
#endif
}


/* ---- tgPM_ABS_S08 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT08 tgPM_ABS_S08( C_TgSINT08 iA )
{
    return ((TgSINT08)abs( iA ));
}


/* ---- tgPM_ABS_S16 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT16 tgPM_ABS_S16( C_TgSINT16 iA )
{
    return ((TgSINT16)abs( iA ));
}


/* ---- tgPM_ABS_S32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT32 tgPM_ABS_S32( C_TgSINT32 iA )
{
    return (abs( iA ));
}


/* ---- tgPM_ABS_S64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT64 tgPM_ABS_S64( C_TgSINT64 iA )
{
    return (_abs64( iA ));
}


/* ---- tgPM_RAND_S_S32 ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgSINT32 tgPM_RAND_S_S32( TgVOID )
{
    TgUINT32                                uiRand;

    if (0 == rand_s( (unsigned int*)&uiRand ))
    {
        return ((TgSINT32)(uiRand - (UINT32_MAX >> 1)));
    }
    else
    {
        return (tgCM_RAND_S32());
    };
}


/* ---- tgPM_RAND_S_U32 ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgUINT32 tgPM_RAND_S_U32( TgVOID )
{
    TgUINT32                                uiRand;

    if (0 == rand_s( &uiRand ))
    {
        return (uiRand);
    }
    else
    {
        return (tgCM_RAND_U32());
    };
}


/* ---- tgPM_NAN_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgBOOL tgPM_NAN_F32( C_TgFLOAT32 fA )
{
#if defined(TgCOMPILE_SUPPORT_MSFT_SYSTEM_INCLUDE)
    return (!_finitef(fA) ? TgTRUE : TgFALSE);
#else
    return (isnanf(fA) ? TgTRUE : TgFALSE);
#endif
}


/* ---- tgPM_CEIL_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_CEIL_F32( C_TgFLOAT32 fA )
{
    return (ceilf( fA ));
}


/* ---- tgPM_FLOOR_F32 -------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_FLOOR_F32( C_TgFLOAT32 fA )
{
    return (floorf( fA ));
}


/* ---- tgPM_SIN_F32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_SIN_F32( C_TgFLOAT32 fA )
{
    return (sinf( fA ));
}


/* ---- tgPM_COS_F32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_COS_F32( C_TgFLOAT32 fA )
{
    return (cosf( fA ));
}


/* ---- tgPM_SINCOS_F32 ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgPM_SINCOS_F32( PCU_TgFLOAT32 pfS, PCU_TgFLOAT32 pfC, C_TgFLOAT32 fA )
{
    TgERROR(0 != pfS && 0 != pfC);
    *pfS = tgPM_SIN_F32( fA );
    *pfC = tgPM_COS_F32( fA );
}


/* ---- tgPM_TAN_F32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_TAN_F32( C_TgFLOAT32 fA )
{
    return (tanf( fA ));
}


/* ---- tgPM_ASIN_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_ASIN_F32( C_TgFLOAT32 fA )
{
    return (asinf( fA ));
}


/* ---- tgPM_ACOS_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_ACOS_F32( C_TgFLOAT32 fA )
{
    return (acosf( fA ));
}


/* ---- tgPM_ATAN_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_ATAN_F32( C_TgFLOAT32 fA )
{
    return (atanf( fA ));
}


/* ---- tgPM_ATAN2_F32 -------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_ATAN2_F32( C_TgFLOAT32 fY, C_TgFLOAT32 fX )
{
    return (atan2f( fY, fX ));
}


/* ---- tgPM_ABS_F32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_ABS_F32( C_TgFLOAT32 fA )
{
    return (fabsf( fA ));
}


/* ---- tgPM_POW_F32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_POW_F32( C_TgFLOAT32 kBase, C_TgFLOAT32 kExponent )
{
    return (powf( kBase, kExponent ));
}


/* ---- tgPM_SQRT_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_SQRT_F32( C_TgFLOAT32 fA )
{
    return (sqrtf( fA ));
}


/* ---- tgPM_EXP_F32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_EXP_F32( C_TgFLOAT32 fX )
{
    return (expf( fX ));
}


/* ---- tgPM_LN_F32 ----------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_LN_F32( C_TgFLOAT32 fX )
{
    return (logf( fX ));
}


/* ---- tgPM_LOG_F32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_LOG_F32( C_TgFLOAT32 fX )
{
    return (log10f( fX ));
}


/* ---- tgPM_SQR_F32 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_SQR_F32( C_TgFLOAT32 fA )
{
    return (fA*fA);
}


/* ---- tgPM_FMOD_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_FMOD_F32( C_TgFLOAT32 fX, C_TgFLOAT32 fY )
{
    return (fmodf( fX, fY ));
}


/* ---- tgPM_FSEL_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_FSEL_F32( C_TgFLOAT32 fA, C_TgFLOAT32 fB, C_TgFLOAT32 fC )
{
    return ((fA >= 0.0F) ? fB : fC);
}


/* ---- tgPM_COPY_SIGN_F32 ---------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgPM_COPY_SIGN_F32( C_TgFLOAT32 fA, C_TgFLOAT32 fB )
{
    return ((TgFLOAT32)_copysignf( fA, fB ));
}


/* ---- tgPM_NAN_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgBOOL tgPM_NAN_F64( C_TgFLOAT64 fA )
{
#if defined(TgCOMPILE_SUPPORT_MSFT_SYSTEM_INCLUDE)
    return (!_finite(fA) ? TgTRUE : TgFALSE);
#else
    return (isnan(fA) ? TgTRUE : TgFALSE);
#endif
}


/* ---- tgPM_CEIL_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_CEIL_F64( C_TgFLOAT64 fA )
{
    return (ceil( fA ));
}


/* ---- tgPM_FLOOR_F64 -------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_FLOOR_F64( C_TgFLOAT64 fA )
{
    return (floor( fA ));
}


/* ---- tgPM_SIN_F64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_SIN_F64( C_TgFLOAT64 fA )
{
    return (sin( fA ));
}


/* ---- tgPM_COS_F64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_COS_F64( C_TgFLOAT64 fA )
{
    return (cos( fA ));
}


/* ---- tgPM_SINCOS_F64 ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgPM_SINCOS_F64( PCU_TgFLOAT64 pfS, PCU_TgFLOAT64 pfC, C_TgFLOAT64 fA )
{
    TgERROR(0 != pfS && 0 != pfC);
    *pfS = tgPM_SIN_F64( fA );
    *pfC = tgPM_COS_F64( fA );
}


/* ---- tgPM_TAN_F64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_TAN_F64( C_TgFLOAT64 fA )
{
    return (tan( fA ));
}


/* ---- tgPM_ASIN_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_ASIN_F64( C_TgFLOAT64 fA )
{
    return (asin( fA ));
}


/* ---- tgPM_ACOS_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_ACOS_F64( C_TgFLOAT64 fA )
{
    return (acos( fA ));
}


/* ---- tgPM_ATAN_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_ATAN_F64( C_TgFLOAT64 fA )
{
    return (atan( fA ));
}


/* ---- tgPM_ATAN2_F64 -------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_ATAN2_F64( C_TgFLOAT64 fY, C_TgFLOAT64 fX )
{
    return (atan2( fY, fX ));
}


/* ---- tgPM_ABS_F64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_ABS_F64( C_TgFLOAT64 fA )
{
    return (fabs( fA ));
}


/* ---- tgPM_POW_F64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_POW_F64( C_TgFLOAT64 kBase, C_TgFLOAT64 kExponent )
{
    return (pow( kBase, kExponent ));
}


/* ---- tgPM_SQRT_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_SQRT_F64( C_TgFLOAT64 fA )
{
    return (sqrt( fA ));
}


/* ---- tgPM_EXP_F64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_EXP_F64( C_TgFLOAT64 fX )
{
    return (exp( fX ));
}


/* ---- tgPM_LN_F64 ----------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_LN_F64( C_TgFLOAT64 fX )
{
    return (log( fX ));
}


/* ---- tgPM_LOG_F64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_LOG_F64( C_TgFLOAT64 fX )
{
    return (log10( fX ));
}


/* ---- tgPM_SQR_F64 ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_SQR_F64( C_TgFLOAT64 fA )
{
    return (fA*fA);
}


/* ---- tgPM_FMOD_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_FMOD_F64( C_TgFLOAT64 fX, C_TgFLOAT64 fY )
{
    return (fmod( fX, fY ));
}


/* ---- tgPM_FSEL_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_FSEL_F64( C_TgFLOAT64 fA, C_TgFLOAT64 fB, C_TgFLOAT64 fC )
{
    return ((fA >= 0.0) ? fB : fC);
}


/* ---- tgPM_COPY_SIGN_F64 ---------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgPM_COPY_SIGN_F64( C_TgFLOAT64 fA, C_TgFLOAT64 fB )
{
    return (_copysign( fA, fB ));
}


/* ---- Thread ---------------------------------------------------------------------------------------------------------------------------------------------------------- */

/* ---- tgTR_Yield ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgTR_Yield( TgVOID )
{
#if TgCOMPILE_THREAD
    g_pfnSwitchToThread();
#endif
}


/* ---- tgTR_Pause ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgTR_Pause( TgVOID )
{
#if TgCOMPILE_THREAD
    _mm_pause();
#endif
}


/* ---- tgTR_Sleep ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgTR_Sleep( C_TgUINT32 uiSleep )
{
#if TgCOMPILE_THREAD
    g_pfnSleep( uiSleep );
#endif
}


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

/* Defined and Supported on X86, X64, ARM */
#define F(A,B) A##B
#include "TgS COMMON/TgS (MSVC-X86) Common - Base - API - Platform [Atomic].i_inc"
#undef F
/* Defined and Supported on ARM - For X86, X64 map the functions back to the standard / default */
#define F(A,B) A##_ACQ##B
#include "TgS COMMON/TgS (MSVC-X86) Common - Base - API - Platform [Atomic].i_inc"
#undef F
#define F(A,B) A##_REL##B
#include "TgS COMMON/TgS (MSVC-X86) Common - Base - API - Platform [Atomic].i_inc"
#undef F
#define F(A,B) A##_NF##B
#include "TgS COMMON/TgS (MSVC-X86) Common - Base - API - Platform [Atomic].i_inc"
#undef F


/* ====================================================================================================================================================================== */
#endif