mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Fix 'generation' type to uint8_t
When we store this value in TT we cut this to 9 bits, so we need a smaller variable otherwise comparisons like: replace->generation() == generation Are always false if generation is bigger then the maximum TT storable value. This fixes a very nasty and difficult to spot bug (2 weeks for regression hunting). Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
d0dc05ad41
commit
200fc56e9c
3 changed files with 6 additions and 6 deletions
|
@ -51,10 +51,10 @@ namespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
CACHE_LINE_ALIGNMENT
|
CACHE_LINE_ALIGNMENT
|
||||||
const int MainSearchPhaseTable[] = { PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
|
const uint8_t MainSearchPhaseTable[] = { PH_TT_MOVES, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP};
|
||||||
const int EvasionsPhaseTable[] = { PH_TT_MOVES, PH_EVASIONS, PH_STOP};
|
const uint8_t EvasionsPhaseTable[] = { PH_TT_MOVES, PH_EVASIONS, PH_STOP};
|
||||||
const int QsearchWithChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_QCHECKS, PH_STOP};
|
const uint8_t QsearchWithChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_QCHECKS, PH_STOP};
|
||||||
const int QsearchWithoutChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_STOP};
|
const uint8_t QsearchWithoutChecksPhaseTable[] = { PH_TT_MOVES, PH_QCAPTURES, PH_STOP};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
Bitboard pinned;
|
Bitboard pinned;
|
||||||
MoveStack ttMoves[2], killers[2];
|
MoveStack ttMoves[2], killers[2];
|
||||||
int badCaptureThreshold, phase;
|
int badCaptureThreshold, phase;
|
||||||
const int* phasePtr;
|
const uint8_t* phasePtr;
|
||||||
MoveStack *curMove, *lastMove, *lastGoodNonCapture, *badCaptures;
|
MoveStack *curMove, *lastMove, *lastGoodNonCapture, *badCaptures;
|
||||||
MoveStack moves[MOVES_MAX];
|
MoveStack moves[MOVES_MAX];
|
||||||
};
|
};
|
||||||
|
|
2
src/tt.h
2
src/tt.h
|
@ -120,7 +120,7 @@ public:
|
||||||
private:
|
private:
|
||||||
size_t size;
|
size_t size;
|
||||||
TTCluster* entries;
|
TTCluster* entries;
|
||||||
int generation;
|
uint8_t generation; // To properly compare, size must be smaller then TT stored value
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TranspositionTable TT;
|
extern TranspositionTable TT;
|
||||||
|
|
Loading…
Add table
Reference in a new issue