forked from nique_372/SimPHash
50 lines
1.9 KiB
MQL5
50 lines
1.9 KiB
MQL5
//+------------------------------------------------------------------+
| |||
//| Fibbo.mqh |
| |||
//| Copyright 2026, Niquel Mendoza |
| |||
//| https://www.mql5.com |
| |||
//+------------------------------------------------------------------+
| |||
#property copyright "Copyright 2026, Niquel Mendoza"
| |||
#property link "https://www.mql5.com"
| |||
#property strict
| |||
| |||
#ifndef SIMPHASH_SRC_HASH_UL1_FIBBO_MQH
| |||
#define SIMPHASH_SRC_HASH_UL1_FIBBO_MQH
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| |
| |||
//+------------------------------------------------------------------+
| |||
#include "..\\Def.mqh"
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| |
| |||
//+------------------------------------------------------------------+
| |||
namespace TSN
| |||
{
| |||
//+------------------------------------------------------------------+
| |||
//| |
| |||
//+------------------------------------------------------------------+
| |||
class CHash1Fibbo : public IHashGeneratorWSeed
| |||
{
| |||
public:
| |||
CHash1Fibbo(void) {}
| |||
~CHash1Fibbo(void) {}
| |||
| |||
ulong Hash(ulong v, const ulong seed) override final
| |||
{
| |||
return (v ^ seed) * 0x9E3779B97F4A7C15;
| |||
}
| |||
| |||
void BuildString(string& data, const string& table_seeds_name) override final
| |||
{
| |||
data += "//---\r\n";
| |||
data += StringFormat(" const ulong h = (key_hash ^ %s[seed_index]) * 0x9E3779B97F4A7C15;\r\n", table_seeds_name);
| |||
data += "\r\n";
| |||
}
| |||
void AddIncludes(string& data) override final
| |||
{
| |||
// Nada
| |||
}
| |||
};
| |||
}
| |||
//+------------------------------------------------------------------+
| |||
#endif // SIMPHASH_SRC_HASH_UL1_FIBBO_MQH
|