///////////////////////////////////////////////////////////////////////////////
/// @file Functions.hpp
///
/// @brief Destiny3D assembly functions for Memory Manager
///
/// @author Lightning
///
/// This file is the intellectual property of Novus Delta, LLC.. Usage of the
/// contents of this file is subject to the Destiny3D Member License which
/// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
///
/// This file is distributed "AS IS" without warranty of any kind.  Novus
/// Delta, LLC. does not guarantee the fitness of the contents of this file
/// for any particular purpose.
///
/// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
///
/// <hr>
///                                 Change History
/// <hr>
///
/// @date Oct 2002
/// @author Lightning
/// @remarks Creation
///
///////////////////////////////////////////////////////////////////////////////

#ifndef DEMEMORY_FUNCTIONS_HPP
#define DEMEMORY_FUNCTIONS_HPP

#include "deGlobalTypes.hpp"

#ifdef __cplusplus
extern "C" {
#endif

//define the paramaters to the functions
typedef void * (*Internal_memccpyFN)(void *Ptr1, const void *Ptr2, const int C, long Len);
typedef void * (*Internal_memchrFN)(const void *Ptr1, const int C, long Len);
typedef long (*Internal_memcmpFN)(const void *Ptr1, const void *Ptr2, long Len);
typedef void * (*Internal_memcpyFN)(void *Ptr1, const void *Ptr2, long Len);
typedef void * (*Internal_memsetFN)(void *Ptr1, int C, long Len);
typedef long (*Internal_strcmpFN)(const char *Str1, const char *Str2);
typedef long (*Internal_strlenFN)(const char *Str);

//define the internal lookup structure used for the functions
typedef struct geMem_InternalFunctions
{
	Internal_memccpyFN	MemCCpy;
	Internal_memchrFN	MemChr;
	Internal_memcmpFN	MemCmp;
	Internal_memcpyFN	MemCpy;
	Internal_memsetFN	MemSet;
	Internal_strcmpFN	StrCmp;
	Internal_strlenFN	StrLen;
} geMem_InternalFunctions;

//init and release functions for the internal functions
deBoolean InitializeInternalFunctions();
void ReleaseInternalFunctions();

//a "global" pointer of what internal functions to use
extern geMem_InternalFunctions *InternalFunctions;


//all the asm function defines that get used

//regular asm versions
void * Internal_ASM_memccpy(void *Ptr1, const void *Ptr2, const int C, long Len);
void * Internal_ASM_memchr(const void *Ptr1, const int C, long Len);
long Internal_ASM_memcmp(const void *Ptr1, const void *Ptr2, long Len);
void * Internal_ASM_memcpy(void *Ptr1, const void *Ptr2, long Len);
void * Internal_ASM_memset(void *Ptr1, int C, long Len);
long Internal_ASM_strcmp(const char *Str1, const char *Str2);
long Internal_ASM_strlen(const char *Str);

//asm and mmx functions
void * Internal_ASM_MMX_memcpy(void *Ptr1, const void *Ptr2, long Len);
void * Internal_ASM_MMX_memset(void *Ptr1, int C, long Len);

//mmx with 3dnow! (AMD) verions
void * Internal_ASM_AMD_MMX_memcpy(void *Ptr1, const void *Ptr2, long Len);

#ifdef __cplusplus
}
#endif

#endif
