+// struct PairsData contains low-level indexing information to access TB data.
+// There are 8, 4, or 2 PairsData records for each TBTable, according to the type
+// of table and if positions have pawns or not. It is populated at first access.
+struct PairsData {
+ uint8_t flags; // Table flags, see enum TBFlag
+ uint8_t maxSymLen; // Maximum length in bits of the Huffman symbols
+ uint8_t minSymLen; // Minimum length in bits of the Huffman symbols
+ uint32_t blocksNum; // Number of blocks in the TB file
+ size_t sizeofBlock; // Block size in bytes
+ size_t span; // About every span values there is a SparseIndex[] entry
+ Sym* lowestSym; // lowestSym[l] is the symbol of length l with the lowest value
+ LR* btree; // btree[sym] stores the left and right symbols that expand sym
+ uint16_t* blockLength; // Number of stored positions (minus one) for each block: 1..65536
+ uint32_t blockLengthSize; // Size of blockLength[] table: padded so it's bigger than blocksNum
+ SparseEntry* sparseIndex; // Partial indices into blockLength[]
+ size_t sparseIndexSize; // Size of SparseIndex[] table
+ uint8_t* data; // Start of Huffman compressed data
+ std::vector<uint64_t>
+ base64; // base64[l - min_sym_len] is the 64bit-padded lowest symbol of length l
+ std::vector<uint8_t>
+ symlen; // Number of values (-1) represented by a given Huffman symbol: 1..256
+ Piece pieces[TBPIECES]; // Position pieces: the order of pieces defines the groups
+ uint64_t groupIdx[TBPIECES + 1]; // Start index used for the encoding of the group's pieces
+ int groupLen[TBPIECES + 1]; // Number of pieces in a given group: KRKN -> (3, 1)
+ uint16_t map_idx[4]; // WDLWin, WDLLoss, WDLCursedWin, WDLBlessedLoss (used in DTZ)
+};