Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
99
CryptoSource/ScriptConvert-GSF File/Utility/Math/Math.h
Normal file
99
CryptoSource/ScriptConvert-GSF File/Utility/Math/Math.h
Normal file
@@ -0,0 +1,99 @@
|
||||
// FastMath.h: interface for the CFastMath class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _CUSTOM_MATH_FUNCTIONS_H_
|
||||
#define _CUSTOM_MATH_FUNCTIONS_H_
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
namespace Math
|
||||
{
|
||||
namespace Convert
|
||||
{
|
||||
extern const unsigned short m_FastHeToBi[0x100];
|
||||
|
||||
// SPX, IPX <20>ּ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20>Լ<EFBFBD>
|
||||
inline TCHAR BiToHe(TCHAR cBin);
|
||||
inline void AcToHe(char *szDst, char *szSrc, int iCount);
|
||||
|
||||
// String<6E><67> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲ<EFBFBD>(String<6E><67> 0x<30><78> <20><><EFBFBD><EFBFBD> Hex string<6E>̴<EFBFBD>.)
|
||||
inline BYTE StrToHex08(const TCHAR *szSrc);
|
||||
inline WORD StrToHex16(const TCHAR *szSrc);
|
||||
inline unsigned long StrToHex32(const TCHAR *szSrc);
|
||||
inline DWORD64 StrToHex64(const TCHAR *szSrc);
|
||||
|
||||
// String<6E><67> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲ<EFBFBD>(0x<30><78> <20>ٴ<EFBFBD><D9B4><EFBFBD>, <20><><EFBFBD><EFBFBD> <20>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ٲ<EFBFBD> <20><> <20>ִ<EFBFBD>)
|
||||
inline BYTE Atoc(const TCHAR *szSrc);
|
||||
inline WORD Atos(const TCHAR *szSrc);
|
||||
inline unsigned long Atoi(const TCHAR *szSrc);
|
||||
inline DWORD64 Atol64(const TCHAR *szSrc);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> Hex String<6E><67><EFBFBD><EFBFBD> <20>ٲ<EFBFBD>
|
||||
inline void Hex08ToStr(TCHAR *szDest, BYTE hex);
|
||||
inline void Hex16ToStr(TCHAR *szDest, WORD hex);
|
||||
inline void Hex32ToStr(TCHAR *szDest, unsigned long hex);
|
||||
inline void Hex64ToStr(TCHAR *szDest, DWORD64 hex);
|
||||
};
|
||||
|
||||
namespace Random
|
||||
{
|
||||
// <20><><EFBFBD>ϰ<EFBFBD><CFB0><EFBFBD> nBeginExtent ~ nEndExtent - 1<><31> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>´<EFBFBD>.
|
||||
unsigned long ComplexRandom(int nEndExtent, int nBeginExtent = 0); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
int SimpleRandom(unsigned long dwSeed, int nEndExtent, int nBeginExtent = 0);
|
||||
};
|
||||
|
||||
namespace HashFunc
|
||||
{
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// String-to-Hash <20>Լ<EFBFBD><D4BC><EFBFBD> : http://www.cs.yorku.ca/~oz/hash.html <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
inline unsigned long djb2Hash(const unsigned char *str); // first reported by dan bernstein
|
||||
inline unsigned long sdbmHash(const unsigned char *str); // this is one of the algorithms used in berkeley db
|
||||
inline unsigned long looseHash(const unsigned char *str); // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ؽ<EFBFBD>. <20>׳<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
};
|
||||
|
||||
namespace Const
|
||||
{
|
||||
static float PI = 3.14159f;
|
||||
}
|
||||
};
|
||||
|
||||
#include "Convert.inl"
|
||||
|
||||
|
||||
|
||||
inline unsigned long Math::HashFunc::djb2Hash(const unsigned char *str)
|
||||
{
|
||||
unsigned long hash = 5381;
|
||||
int c;
|
||||
|
||||
while (c = *str++) { hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ }
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long Math::HashFunc::sdbmHash(const unsigned char *str)
|
||||
{
|
||||
unsigned long hash = 0;
|
||||
int c;
|
||||
|
||||
while (c = *str++) { hash = c + (hash << 6) + (hash << 16) - hash; }
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long Math::HashFunc::looseHash(const unsigned char *str)
|
||||
{
|
||||
unsigned int hash = 0;
|
||||
int c;
|
||||
|
||||
while (c = *str++) { hash += c; }
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
#endif // !defined(AFX_FASTMATH_H__ED69578B_18C1_42EA_9C5E_888DC38101C2__INCLUDED_)
|
||||
Reference in New Issue
Block a user