2026-09-03 20:38:40 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| Hash.mqh |
|
| | | //| Copyright 2026, Niquel Mendoza |
|
| | | //| https://www.mql5.com |
|
| | | //+------------------------------------------------------------------+
|
| | | #property copyright "Copyright 2026, Niquel Mendoza"
|
| | | #property link "https://www.mql5.com"
|
| | | #property strict
|
| | |
|
| | | #ifndef MQLARTICLES_UTILS_BITS_HASH_MQH
|
| | | #define MQLARTICLES_UTILS_BITS_HASH_MQH
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | #include "BitFastBuffer.mqh"
|
| | | #include <TSN\\Tables\\AllHashes.mqh>
|
2026-09-03 21:19:19 -05:00 | | | #include <TSN\\GCol\\HashMap.mqh>
|
2026-09-03 20:38:40 -05:00 | | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | namespace TSN
|
| | | {
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
2026-09-03 21:50:10 -05:00 | | | class CGenericHash_CBitBuffer
|
2026-09-03 20:38:40 -05:00 | | | {
|
| | | public:
|
| | | CGenericHash_CBitBuffer() {}
|
| | | ~CGenericHash_CBitBuffer() {}
|
| | |
|
2026-09-03 21:19:19 -05:00 | | | //---
|
2026-09-03 20:38:40 -05:00 | | | static ulong Hash(const CBitBuffer &v)
|
| | | {
|
| | | return TSN::XUL::XXH64(v.m_bits, v.m_s + 1, 0ULL);
|
| | | }
|
| | |
|
2026-09-03 21:19:19 -05:00 | | | //---
|
2026-09-03 20:38:40 -05:00 | | | static bool Eq(const CBitBuffer &a, const CBitBuffer &b)
|
| | | {
|
| | | if(a.m_s != b.m_s)
|
| | | return false;
|
| | | // igual dado que el array en si size real es ms + (w > 0)
|
| | | // ms reprensta la escritura actual
|
| | | for(int i = 0; i <= a.m_s; i++)
|
| | | if(a.m_bits[i] != b.m_bits[i])
|
| | | return false;
|
| | | return true;
|
| | | }
|
2026-09-03 21:19:19 -05:00 | | |
|
| | | //---
|
| | | template <typename TValue>
|
| | | static void Assing(CHashMapFastInternalPar<CBitBuffer, TValue>& a, CHashMapFastInternalPar<CBitBuffer, TValue>& b)
|
| | | {
|
| | | a.hash = b.hash;
|
| | | a.value = b.value;
|
| | | a.key.RobarDe(b.key);
|
| | | }
|
2026-09-03 20:38:40 -05:00 | | | };
|
| | | }
|
| | | //+------------------------------------------------------------------+
|
| | | #endif // MQLARTICLES_UTILS_BITS_HASH_MQH
|