JsonParserByLeo/Src/Tables/Table.mqh

81 lines
2.5 KiB
MQL5
Raw Permalink Normal View History

2026-06-29 09:01:48 -05:00
//+-------------------------------------------------------------------+
//| Include generado por la herramienta PerfectHash SimPHash |
//| Esta heramienta forma parte del ecositema TSN |
//| Repositorio: https://forge.mql5.io/nique_372/SimPHash |
//+-------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza"
#property link "https://www.mql5.com/"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include <TSN/Tables/AllHashes.mqh>
#ifndef JSONPARSERBYLEO_SRC_TABLES_TABLES_MQH
#define JSONPARSERBYLEO_SRC_TABLES_TABLES_MQH
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#define JPBL_ENUMREG_TABLE_SIZE_EXT (3ULL)
#define JPBL_ENUMREG_BUCKET_SIZE_EXT (1ULL)
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
namespace TSN
{
const ulong g_jsonparserbyleo_ext_seeds[JPBL_ENUMREG_BUCKET_SIZE_EXT] =
{
2ULL
};
const ulong g_jsonparserbyleo_ext_hashes[JPBL_ENUMREG_TABLE_SIZE_EXT] =
{
8494794881307187142ULL, // jsonasm
9663995960464164898ULL, // jsontc
2358882204983900163ULL
};
const long g_jsonparserbyleo_ext_values[JPBL_ENUMREG_TABLE_SIZE_EXT] =
{
2026-07-20 12:04:54 -05:00
2, // jsonasm
1, // jsontc
2026-06-29 09:01:48 -05:00
0 // json
};
long JPBL_HashExt(const string& key)
{
//---
const int len = StringLen(key);
ulong key_hash = 14695981039346656037ULL;
// Custom para extension files...
bool is = false;
for(int i = 0; i < len; i++)
{
if(is)
{
key_hash ^= (uchar)key[i];
key_hash *= 1099511628211ULL;
continue;
}
if(key[i] == '.')
is = true;
}
const int seed_index = int(key_hash % JPBL_ENUMREG_BUCKET_SIZE_EXT);
//---
ulong h = key_hash + g_jsonparserbyleo_ext_seeds[seed_index] * 0x9e3779b97f4a7c15;
h = (h ^ (h >> 30)) * 0xbf58476d1ce4e5b9;
h = (h ^ (h >> 27)) * 0x94d049bb133111eb;
h ^= (h >> 31);
const int fi = int(h % JPBL_ENUMREG_TABLE_SIZE_EXT);
return g_jsonparserbyleo_ext_hashes[fi] == key_hash ? g_jsonparserbyleo_ext_values[fi] : 0;
}
}
#endif // JSONPARSERBYLEO_SRC_TABLES_TABLES_MQH