Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Base - API.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_API_INL)
#define TGS_COMMON_BASE_API_INL
#pragma once


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

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

/* ---- tgCM_FLR_ALGN_PW2_UPTR ------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgUINTPTR tgCM_FLR_ALGN_PW2_UPTR( C_TgUINTPTR uiA, C_TgUINTPTR uiAlignment )
{
#if TgCOMPILE_64BIT_POINTER
    return (tgCM_FLR_ALGN_PW2_U64( (TgUINT64)uiA, (TgUINT64)uiAlignment ));
#else
    return (tgCM_FLR_ALGN_PW2_U32( (TgUINT32)uiA, (TgUINT32)uiAlignment ));
#endif
}


/* ---- tgCM_CEL_ALGN_PW2_UPTR ------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgUINTPTR tgCM_CEL_ALGN_PW2_UPTR( C_TgUINTPTR uiA, C_TgUINTPTR uiAlignment )
{
#if TgCOMPILE_64BIT_POINTER
    return (tgCM_CEL_ALGN_PW2_U64( (TgUINT64)uiA, (TgUINT64)uiAlignment ));
#else
    return (tgCM_CEL_ALGN_PW2_U32( (TgUINT32)uiA, (TgUINT32)uiAlignment ));
#endif
}


/* ---- tgCM_RAND_F32 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT32 tgCM_RAND_F32( TgVOID )
{
    return (tgCM_RAND_MT_U32() / 4294967296.0F);
}


/* ---- tgCM_RAND_F64 --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgFLOAT64 tgCM_RAND_F64( TgVOID )
{
    C_TgUINT32                              uiA = tgCM_RAND_MT_U32() >> 5;
    C_TgUINT32                              uiB = tgCM_RAND_MT_U32() >> 6;

    return (uiA * 67108864.0 + uiB) * (1.0 / 9007199254740992.0);
}


/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

#define INT_SIGNED 0

#define PCU_TYPE PCU_TgUINT08
#define TYPE TgUINT08
#define F(A) A##_U08
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef TYPE
#undef PCU_TYPE

/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

#define PCU_TYPE PCU_TgUINT16
#define TYPE TgUINT16
#define F(A) A##_U16
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef TYPE
#undef PCU_TYPE

/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

#define PCU_TYPE PCU_TgUINT32
#define TYPE TgUINT32
#define F(A) A##_U32
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef TYPE
#undef PCU_TYPE

/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

#define PCU_TYPE PCU_TgUINT64
#define TYPE TgUINT64
#define F(A) A##_U64
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef TYPE
#undef PCU_TYPE

#undef INT_SIGNED

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

#define INT_SIGNED 1

#define PCU_TYPE PCU_TgSINT08
#define UTYPE TgUINT08
#define TYPE TgSINT08
#define FU(A) A##_U08
#define F(A) A##_S08
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef FU
#undef TYPE
#undef UTYPE
#undef PCU_TYPE

/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

#define PCU_TYPE PCU_TgSINT16
#define UTYPE TgUINT16
#define TYPE TgSINT16
#define FU(A) A##_U16
#define F(A) A##_S16
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef FU
#undef TYPE
#undef UTYPE
#undef PCU_TYPE

/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

#define PCU_TYPE PCU_TgSINT32
#define UTYPE TgUINT32
#define TYPE TgSINT32
#define FU(A) A##_U32
#define F(A) A##_S32
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef FU
#undef TYPE
#undef UTYPE
#undef PCU_TYPE

/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

#define PCU_TYPE PCU_TgSINT64
#define UTYPE TgUINT64
#define TYPE TgSINT64
#define FU(A) A##_U64
#define F(A) A##_S64
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef FU
#undef TYPE
#undef UTYPE
#undef PCU_TYPE

#undef INT_SIGNED

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

#define PCU_TYPE PCU_TgFLOAT32
#define TYPE TgFLOAT32
#define F(A) A##_F32
#define MKL(A) A##F
#include "TgS COMMON/TgS Common - Base - API [F].i_inc"
#undef MKL
#undef F
#undef TYPE
#undef PCU_TYPE

/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

#define PCU_TYPE PCU_TgFLOAT64
#define TYPE TgFLOAT64
#define F(A) A##_F64
#define MKL(A) A
#include "TgS COMMON/TgS Common - Base - API [F].i_inc"
#undef MKL
#undef F
#undef TYPE
#undef PCU_TYPE

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

#define INT_SIGNED 0

#define PCU_TYPE PCU_TgUINTXX
#define TYPE TgUINTXX
#define F(A) A##_UXX
#include "TgS COMMON/TgS Common - Base - API [I].i_inc"
#undef F
#undef TYPE
#undef PCU_TYPE

/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

#undef INT_SIGNED


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