diff --git a/src/history.h b/src/history.h index a16338b3..35163903 100644 --- a/src/history.h +++ b/src/history.h @@ -26,7 +26,7 @@ #include "types.h" -#define QuietEntry(move) (&thread->history[thread->pos.stm][fromSq(move)][toSq(move)]) +#define QuietEntry(move) (&thread->history[kingSq(pos->stm)][pos->stm][fromSq(move)][toSq(move)]) #define NoisyEntry(move) (&thread->captureHistory[piece(move)][toSq(move)][PieceTypeOf(capturing(move))]) #define ContEntry(offset, move) (&(*(ss-offset)->continuation)[piece(move)][toSq(move)]) @@ -52,6 +52,8 @@ INLINE void UpdateContHistories(Stack *ss, Move move, int bonus) { // Updates history heuristics when a quiet move is the best move INLINE void UpdateQuietHistory(Thread *thread, Stack *ss, Move bestMove, int bonus, Depth depth, Move quiets[], int qCount) { + Position *pos = &thread->pos; + // Update killers if (ss->killers[0] != bestMove) { ss->killers[1] = ss->killers[0]; @@ -90,6 +92,7 @@ INLINE void UpdateHistory(Thread *thread, Stack *ss, Move bestMove, Depth depth, } INLINE int GetQuietHistory(const Thread *thread, Stack *ss, Move move) { + const Position *pos = &thread->pos; return *QuietEntry(move) + *ContEntry(1, move) + *ContEntry(2, move) diff --git a/src/threads.h b/src/threads.h index d1812ede..723b03a1 100644 --- a/src/threads.h +++ b/src/threads.h @@ -29,7 +29,7 @@ #define MULTI_PV_MAX 64 -typedef int16_t ButterflyHistory[COLOR_NB][64][64]; +typedef int16_t ButterflyHistory[64][COLOR_NB][64][64]; typedef int16_t CaptureToHistory[PIECE_NB][64][TYPE_NB]; typedef int16_t PieceToHistory[PIECE_NB][64]; typedef PieceToHistory ContinuationHistory[PIECE_NB][64];