FastCollections-FastHashMap/Src/ColHash/Hash/Generic.mqh

38 lines
1.4 KiB
MQL5
Raw Permalink Normal View History

2026-07-19 08:34:18 -05:00
//+------------------------------------------------------------------+
//| Generic.mqh |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com/"
#property strict
2026-07-21 11:09:28 -05:00
#ifndef FASTCOLLECTIONSBYLEO_COLHASH_HASH_GENERIC_MQH
#define FASTCOLLECTIONSBYLEO_COLHASH_HASH_GENERIC_MQH
2026-07-19 08:34:18 -05:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
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;
}
};
}
//+------------------------------------------------------------------+
2026-07-21 11:09:28 -05:00
#endif // FASTCOLLECTIONSBYLEO_COLHASH_HASH_GENERIC_MQH