38 lines
No EOL
1.4 KiB
MQL5
38 lines
No EOL
1.4 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Generic.mqh |
|
|
//| Copyright 2026, Niquel Mendoza. |
|
|
//| https://www.mql5.com/ |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright 2026, Niquel Mendoza."
|
|
#property link "https://www.mql5.com/"
|
|
#property strict
|
|
|
|
#ifndef FASTCOLLECTIONSBYLEO_COLHASH_HASH_GENERIC_MQH
|
|
#define FASTCOLLECTIONSBYLEO_COLHASH_HASH_GENERIC_MQH
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
namespace TSN
|
|
{
|
|
class CGenericHash_string
|
|
{
|
|
public:
|
|
CGenericHash_string(void) {}
|
|
~CGenericHash_string(void) {}
|
|
static __forceinline bool Eq(const string& a, const string& b) { return a == b; }
|
|
static ulong Hash(const string& key)
|
|
{
|
|
ulong hash = 14695981039346656037ULL;
|
|
const int len = StringLen(key);
|
|
for(int i = 0; i < len; i++)
|
|
{
|
|
hash ^= (ulong)key[i];
|
|
hash *= 1099511628211ULL;
|
|
}
|
|
return hash;
|
|
}
|
|
};
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
#endif // FASTCOLLECTIONSBYLEO_COLHASH_HASH_GENERIC_MQH |