MQLArticles/Utils/Dict/Defines.mqh
2026-05-31 15:28:34 -05:00

50 lines
No EOL
1.7 KiB
MQL5

//+------------------------------------------------------------------+
//| Defines.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_DICT_DEFINES_MQH
#define MQLARTICLES_UTILS_DICT_DEFINES_MQH
//+------------------------------------------------------------------+
//| Funciones hash base |
//+------------------------------------------------------------------+
#ifndef CDICT_HASH
#define CDICT_HASH(key, hash) \
const int _len = StringLen(key); \
hash = 2166136261; \
for(int _i = 0; _i < _len; _i++) \
{ \
hash ^= (uint)key[_i]; \
hash *= 16777619; \
}
#endif // CDICT_HASH, se da la posiblidad de definir un hash custom
//---
#ifndef CDICT_HASH_U
#define CDICT_HASH_U(_arr, _start, _end, hash) \
hash = 2166136261; \
for(int _i = _start; _i <= _end; _i++) \
{ \
hash ^= (uint)_arr[_i]; \
hash *= 16777619; \
}
#endif // CDICT_HASH_U, se da la posiblidad de definir un hash custom
//--- Factor de crecimiento float
#ifndef MQLARTICLES_DICT_FACTOR_CRECIMIENTO
#define MQLARTICLES_DICT_FACTOR_CRECIMIENTO (0.75f)
#endif // MQLARTICLES_DICT_SLOT_SIZE
//--- Tamaño de slots por bucket
#ifndef MQLARTICLES_DICT_SLOT_SIZE
#define MQLARTICLES_DICT_SLOT_SIZE (16)
#endif // MQLARTICLES_DICT_SLOT_SIZE
#endif // MQLARTICLES_UTILS_DICT_DEFINES_MQH