-#include "bitcount.h"
-#include "rkiss.h"
-
-Bitboard RMasks[64];
-Bitboard RMagics[64];
-Bitboard* RAttacks[64];
-int RShifts[64];
-
-Bitboard BMasks[64];
-Bitboard BMagics[64];
-Bitboard* BAttacks[64];
-int BShifts[64];
-
-Bitboard SetMaskBB[65];
-Bitboard ClearMaskBB[65];
-
-Bitboard SquaresByColorBB[2];
-Bitboard FileBB[8];
-Bitboard RankBB[8];
-Bitboard NeighboringFilesBB[8];
-Bitboard ThisAndNeighboringFilesBB[8];
-Bitboard InFrontBB[2][8];
-Bitboard StepAttacksBB[16][64];
-Bitboard BetweenBB[64][64];
-Bitboard SquaresInFrontMask[2][64];
-Bitboard PassedPawnMask[2][64];
-Bitboard AttackSpanMask[2][64];
-
-Bitboard BishopPseudoAttacks[64];
-Bitboard RookPseudoAttacks[64];
-Bitboard QueenPseudoAttacks[64];
-
-uint8_t BitCount8Bit[256];
-int SquareDistance[64][64];
+#include "misc.h"
+
+uint8_t PopCnt16[1 << 16];
+int SquareDistance[SQUARE_NB][SQUARE_NB];
+
+Bitboard RookMasks [SQUARE_NB];
+Bitboard RookMagics [SQUARE_NB];
+Bitboard* RookAttacks[SQUARE_NB];
+unsigned RookShifts [SQUARE_NB];
+
+Bitboard BishopMasks [SQUARE_NB];
+Bitboard BishopMagics [SQUARE_NB];
+Bitboard* BishopAttacks[SQUARE_NB];
+unsigned BishopShifts [SQUARE_NB];
+
+Bitboard SquareBB[SQUARE_NB];
+Bitboard FileBB[FILE_NB];
+Bitboard RankBB[RANK_NB];
+Bitboard AdjacentFilesBB[FILE_NB];
+Bitboard InFrontBB[COLOR_NB][RANK_NB];
+Bitboard StepAttacksBB[PIECE_NB][SQUARE_NB];
+Bitboard BetweenBB[SQUARE_NB][SQUARE_NB];
+Bitboard LineBB[SQUARE_NB][SQUARE_NB];
+Bitboard DistanceRingBB[SQUARE_NB][8];
+Bitboard ForwardBB[COLOR_NB][SQUARE_NB];
+Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB];
+Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB];
+Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB];