2026-06-28 19:22:20 -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/"
|
2026-06-28 10:43:20 -05:00
|
|
|
#property strict
|
|
|
|
|
|
2026-06-28 19:22:20 -05:00
|
|
|
|
2026-06-28 10:43:20 -05:00
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
#include <TSN/Tables/AllHashes.mqh>
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| |
|
|
|
|
|
//+------------------------------------------------------------------+
|
2026-06-28 19:22:20 -05:00
|
|
|
#define TABLE_SIZE_FINAL (6ULL)
|
|
|
|
|
#define TABLE_SIZE_BUCKETS (1ULL)
|
2026-06-28 10:43:20 -05:00
|
|
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
namespace TSN
|
|
|
|
|
{
|
2026-06-28 19:22:20 -05:00
|
|
|
const ulong g_table_test_seeds[TABLE_SIZE_BUCKETS] =
|
2026-06-28 10:43:20 -05:00
|
|
|
{
|
2026-06-28 19:22:20 -05:00
|
|
|
25ULL
|
2026-06-28 10:43:20 -05:00
|
|
|
};
|
|
|
|
|
|
2026-06-28 19:22:20 -05:00
|
|
|
const ulong g_table_test_hashes[TABLE_SIZE_FINAL] =
|
2026-06-28 10:43:20 -05:00
|
|
|
{
|
2026-06-28 19:22:20 -05:00
|
|
|
7082449285793839247ULL, // UNO
|
|
|
|
|
8077034385145237811ULL, // TRES
|
|
|
|
|
1578112930777586163ULL, // CUATRO
|
|
|
|
|
889639972767027087ULL, // CINCO
|
|
|
|
|
0ULL, // invalid
|
|
|
|
|
16162063474616199333ULL
|
2026-06-28 10:43:20 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const long g_table_test_values[TABLE_SIZE_FINAL] =
|
|
|
|
|
{
|
|
|
|
|
1, // UNO
|
2026-06-28 19:22:20 -05:00
|
|
|
3, // TRES
|
2026-06-28 10:43:20 -05:00
|
|
|
4, // CUATRO
|
2026-06-28 19:22:20 -05:00
|
|
|
5, // CINCO
|
|
|
|
|
-1,
|
|
|
|
|
2 // DOS
|
2026-06-28 10:43:20 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
long HashCustom(const string& key)
|
|
|
|
|
{
|
|
|
|
|
//---
|
|
|
|
|
const int len = StringLen(key);
|
2026-06-28 19:22:20 -05:00
|
|
|
ulong key_hash = 14695981039346656037ULL;
|
|
|
|
|
FNV1a_64_AsM_Str(key, len, key_hash, 1099511628211ULL)
|
2026-06-28 10:43:20 -05:00
|
|
|
|
2026-06-28 19:22:20 -05:00
|
|
|
const int seed_index = int(key_hash % TABLE_SIZE_BUCKETS);
|
|
|
|
|
//---
|
2026-06-28 10:43:20 -05:00
|
|
|
ulong h = key_hash ^ g_table_test_seeds[seed_index];
|
|
|
|
|
h ^= h >> 16;
|
|
|
|
|
h *= 0x45d9f3b37197344d;
|
|
|
|
|
h ^= h >> 16;
|
|
|
|
|
h *= 0x45d9f3b37197344d;
|
|
|
|
|
h ^= h >> 16;
|
|
|
|
|
|
|
|
|
|
const int fi = int(h % TABLE_SIZE_FINAL);
|
|
|
|
|
return g_table_test_hashes[fi] == key_hash ? g_table_test_values[fi] : -1;
|
|
|
|
|
}
|
2026-06-28 19:22:20 -05:00
|
|
|
}
|