MQLArticles/Utils/Bits
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-06 11:15:27 -05:00
..
Ben.mq5 new files added 2026-09-03 20:16:56 -05:00
BitFastBuffer.mqh 2026-09-03 21:50:10 -05:00
Def.mqh new files added 2026-09-03 19:55:19 -05:00
Hash.mqh 2026-09-03 21:50:10 -05:00
HMTest.mq5 2026-09-03 20:38:53 -05:00
README.md new files added 2026-09-06 11:15:27 -05:00
Test.mq5 new files added 2026-09-03 19:55:19 -05:00

← Utils

Utils/Bits

Bit manipulation, fast serialization buffers, and hashing support used by the ecosystem's hash maps.

Main features

  • Fast write-oriented bit buffer: booleans, integers, arrays, doubles, floats, padded strings (CBitBuffer in BitFastBuffer.mqh).
  • Little-endian / big-endian byte (de)serialization (FromBytesLE, FromBytesBE, ToBytes).
  • Generic hash + equality implementation for CBitBuffer, so it can be used as a key in TSN hash maps (TSN::CGenericHash_CBitBuffer in Hash.mqh, built on XXH64).

Basic usage

CBitBuffer bit;
bit.WriteBool(true);
bit.WriteInteger(42);
bit.WriteDouble(3.14);

uchar buf[];
int written = bit.ToBytes(buf);
// Using CBitBuffer as a hash map key:
TSN::CHashMapFastNor<TSN::CBitBuffer, int, TSN::CGenericHash_CBitBuffer> cache;

Only the most representative methods are shown here.