//+-------------------------------------------------------------------+ //| 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 //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ #define TABLE_SIZE_FINAL (8ULL) #define TABLE_SIZE_FINAL_LAST (7ULL) #define TABLE_SIZE_BUCKETS (1ULL) #define TABLE_SIZE_BUCKETS_LAST (0ULL) //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ namespace TSN { const ulong g_table_test_seeds[TABLE_SIZE_BUCKETS] = { 5ULL }; const ulong g_table_test_hashes[TABLE_SIZE_FINAL] = { 0ULL, // invalid 16162063474616199333ULL, // DOS 0ULL, // invalid 889639972767027087ULL, // CINCO 0ULL, // invalid 7082449285793839247ULL, // UNO 1578112930777586163ULL, // CUATRO 8077034385145237811ULL }; const long g_table_test_values[TABLE_SIZE_FINAL] = { -1, 2, // DOS -1, 5, // CINCO -1, 1, // UNO 4, // CUATRO 3 // TRES }; long HashCustom(const string key) { //--- const int len = StringLen(key); ulong key_hash = 14695981039346656037ULL; FNV1a_64_AsM_Str(key, len, key_hash, 1099511628211ULL) const int seed_index = int(key_hash & TABLE_SIZE_BUCKETS_LAST); //--- 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_LAST); return g_table_test_hashes[fi] == key_hash ? g_table_test_values[fi] : -1; } long HashCustom(const ulong key_hash) { const int seed_index = int(key_hash & TABLE_SIZE_BUCKETS_LAST); //--- 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_LAST); return g_table_test_hashes[fi] == key_hash ? g_table_test_values[fi] : -1; } }